File tree Expand file tree Collapse file tree
model/src/main/java/com/basistech/rosette/apimodel Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131public class CategoriesOptions extends Options {
3232
3333 /**
34+ * @deprecated
35+ * Users should use {@link singleLabel} to return only one result
36+ * or {@link scoreThreshold} to filter results based on raw score
3437 * @return number of categories
3538 */
3639 @ Min (1 )
3740 private final Integer numCategories ;
41+
42+ /**
43+ * Single label mode will return only the highest scoring category, regardless of score
44+ * If singleLabel is false, every category whose score exceeds the default
45+ * (or specified) {@link scoreThreshold} value will be returned
46+ * @return whether or not we are in single label mode
47+ */
48+ private final Boolean singleLabel ;
49+
50+ /**
51+ * threshold against the category's raw score, whose value
52+ * can be any real number.
53+ * @return the score threshold
54+ */
55+ private final Float scoreThreshold ;
3856}
Original file line number Diff line number Diff line change @@ -35,5 +35,5 @@ public class CategoriesResponse extends Response {
3535 /**
3636 * @return a list of categories
3737 */
38- private final List <Label > categories ;
38+ private final List <CategoryLabel > categories ;
3939}
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2018 Basis Technology Corp.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ package com .basistech .rosette .apimodel ;
17+
18+ import com .basistech .rosette .annotations .JacksonMixin ;
19+ import lombok .Builder ;
20+ import lombok .Value ;
21+
22+ @ Value
23+ @ Builder
24+ @ JacksonMixin
25+ public class CategoryLabel {
26+
27+ /**
28+ * @return the label.
29+ */
30+ private final String label ;
31+
32+ /**
33+ * @return the confidence score (0.0-1.0)
34+ */
35+ private final Double confidence ;
36+
37+ /**
38+ * @return the raw score (-INF-INF)
39+ */
40+ private final Double score ;
41+ }
Original file line number Diff line number Diff line change 3030@ EqualsAndHashCode
3131@ Builder
3232@ JacksonMixin
33- public class SentimentResponse extends Response {
33+ public class SentimentResponse extends Response {
3434
3535 /**
3636 * @return the whole-document sentiment.
You can’t perform that action at this time.
0 commit comments