Skip to content

Commit 640334c

Browse files
authored
Added predictions in detect result
1 parent 58a8eb4 commit 640334c

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.translated.lara.translator;
2+
3+
public class DetectPrediction {
4+
private final String language;
5+
private final double confidence;
6+
7+
public DetectPrediction(String language, double confidence) {
8+
this.language = language;
9+
this.confidence = confidence;
10+
}
11+
12+
public String getLanguage() {
13+
return language;
14+
}
15+
16+
public double getConfidence() {
17+
return confidence;
18+
}
19+
}

src/main/java/com/translated/lara/translator/DetectResult.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package com.translated.lara.translator;
22

3+
import java.util.List;
4+
35
public class DetectResult {
46
private final String language;
57
private final String contentType;
8+
private final List<DetectPrediction> predictions;
69

7-
public DetectResult(String language, String contentType) {
10+
public DetectResult(String language, String contentType, List<DetectPrediction> predictions) {
811
this.language = language;
912
this.contentType = contentType;
13+
this.predictions = predictions;
1014
}
1115

1216
public String getLanguage() {
@@ -16,4 +20,8 @@ public String getLanguage() {
1620
public String getContentType() {
1721
return contentType;
1822
}
23+
24+
public List<DetectPrediction> getPredictions() {
25+
return predictions;
26+
}
1927
}

0 commit comments

Comments
 (0)