|
12 | 12 | */ |
13 | 13 | package com.ibm.watson.developer_cloud.discovery.v1.model; |
14 | 14 |
|
15 | | -import java.util.List; |
16 | | - |
17 | 15 | import com.ibm.watson.developer_cloud.service.model.GenericModel; |
18 | 16 |
|
19 | 17 | /** |
20 | 18 | * Options which are specific to a particular enrichment. |
21 | 19 | */ |
22 | 20 | public class EnrichmentOptions extends GenericModel { |
23 | 21 |
|
24 | | - /** |
25 | | - * If provided, then do not attempt to detect the language of the input document. Instead, assume the language is the |
26 | | - * one specified in this field. You can set this property to work around `unsupported-text-language` errors. Supported |
27 | | - * languages include English, German, French, Italian, Portuguese, Russian, Spanish and Swedish. Supported language |
28 | | - * codes are the ISO-639-1, ISO-639-2, ISO-639-3, and the plain english name of the language (for example "russian"). |
29 | | - */ |
30 | | - public interface Language { |
31 | | - /** english. */ |
32 | | - String ENGLISH = "english"; |
33 | | - /** german. */ |
34 | | - String GERMAN = "german"; |
35 | | - /** french. */ |
36 | | - String FRENCH = "french"; |
37 | | - /** italian. */ |
38 | | - String ITALIAN = "italian"; |
39 | | - /** portuguese. */ |
40 | | - String PORTUGUESE = "portuguese"; |
41 | | - /** russian. */ |
42 | | - String RUSSIAN = "russian"; |
43 | | - /** spanish. */ |
44 | | - String SPANISH = "spanish"; |
45 | | - /** swedish. */ |
46 | | - String SWEDISH = "swedish"; |
47 | | - /** en. */ |
48 | | - String EN = "en"; |
49 | | - /** eng. */ |
50 | | - String ENG = "eng"; |
51 | | - /** de. */ |
52 | | - String DE = "de"; |
53 | | - /** ger. */ |
54 | | - String GER = "ger"; |
55 | | - /** deu. */ |
56 | | - String DEU = "deu"; |
57 | | - /** fr. */ |
58 | | - String FR = "fr"; |
59 | | - /** fre. */ |
60 | | - String FRE = "fre"; |
61 | | - /** fra. */ |
62 | | - String FRA = "fra"; |
63 | | - /** it. */ |
64 | | - String IT = "it"; |
65 | | - /** ita. */ |
66 | | - String ITA = "ita"; |
67 | | - /** pt. */ |
68 | | - String PT = "pt"; |
69 | | - /** por. */ |
70 | | - String POR = "por"; |
71 | | - /** ru. */ |
72 | | - String RU = "ru"; |
73 | | - /** rus. */ |
74 | | - String RUS = "rus"; |
75 | | - /** es. */ |
76 | | - String ES = "es"; |
77 | | - /** spa. */ |
78 | | - String SPA = "spa"; |
79 | | - /** sv. */ |
80 | | - String SV = "sv"; |
81 | | - /** swe. */ |
82 | | - String SWE = "swe"; |
83 | | - } |
84 | | - |
85 | | - private List<String> extract; |
86 | | - private Boolean sentiment; |
87 | | - private Boolean quotations; |
88 | | - private Boolean showSourceText; |
89 | | - private Boolean hierarchicalTypedRelations; |
90 | | - private String model; |
91 | | - private String language; |
92 | | - |
93 | | - /** |
94 | | - * Gets the extract. |
95 | | - * |
96 | | - * A comma-separated list of analyses that will be applied when using the `alchemy_language` enrichment. See the |
97 | | - * service documentation for details on each extract option. Possible values include: * entity * keyword * taxonomy * |
98 | | - * concept * relation * doc-sentiment * doc-emotion * typed-rels |
99 | | - * |
100 | | - * @return the extract |
101 | | - */ |
102 | | - public List<String> getExtract() { |
103 | | - return extract; |
104 | | - } |
| 22 | + private NluEnrichmentFeatures features; |
105 | 23 |
|
106 | 24 | /** |
107 | | - * Gets the sentiment. |
108 | | - * |
109 | | - * @return the sentiment |
| 25 | + * Builder. |
110 | 26 | */ |
111 | | - public Boolean isSentiment() { |
112 | | - return sentiment; |
| 27 | + public static class Builder { |
| 28 | + private NluEnrichmentFeatures features; |
| 29 | + |
| 30 | + private Builder(EnrichmentOptions enrichmentOptions) { |
| 31 | + features = enrichmentOptions.features; |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * Instantiates a new builder. |
| 36 | + */ |
| 37 | + public Builder() { |
| 38 | + } |
| 39 | + |
| 40 | + /** |
| 41 | + * Builds a EnrichmentOptions. |
| 42 | + * |
| 43 | + * @return the enrichmentOptions |
| 44 | + */ |
| 45 | + public EnrichmentOptions build() { |
| 46 | + return new EnrichmentOptions(this); |
| 47 | + } |
| 48 | + |
| 49 | + /** |
| 50 | + * Set the features. |
| 51 | + * |
| 52 | + * @param features the features |
| 53 | + * @return the EnrichmentOptions builder |
| 54 | + */ |
| 55 | + public Builder features(NluEnrichmentFeatures features) { |
| 56 | + this.features = features; |
| 57 | + return this; |
| 58 | + } |
113 | 59 | } |
114 | 60 |
|
115 | | - /** |
116 | | - * Gets the quotations. |
117 | | - * |
118 | | - * @return the quotations |
119 | | - */ |
120 | | - public Boolean isQuotations() { |
121 | | - return quotations; |
| 61 | + private EnrichmentOptions(Builder builder) { |
| 62 | + features = builder.features; |
122 | 63 | } |
123 | 64 |
|
124 | 65 | /** |
125 | | - * Gets the showSourceText. |
| 66 | + * New builder. |
126 | 67 | * |
127 | | - * @return the showSourceText |
| 68 | + * @return a EnrichmentOptions builder |
128 | 69 | */ |
129 | | - public Boolean isShowSourceText() { |
130 | | - return showSourceText; |
| 70 | + public Builder newBuilder() { |
| 71 | + return new Builder(this); |
131 | 72 | } |
132 | 73 |
|
133 | 74 | /** |
134 | | - * Gets the hierarchicalTypedRelations. |
| 75 | + * Gets the features. |
135 | 76 | * |
136 | | - * @return the hierarchicalTypedRelations |
137 | | - */ |
138 | | - public Boolean isHierarchicalTypedRelations() { |
139 | | - return hierarchicalTypedRelations; |
140 | | - } |
141 | | - |
142 | | - /** |
143 | | - * Gets the model. |
144 | | - * |
145 | | - * Required when using the `typed-rel` extract option. Should be set to the ID of a previously published custom Watson |
146 | | - * Knowledge Studio model. |
147 | | - * |
148 | | - * @return the model |
149 | | - */ |
150 | | - public String getModel() { |
151 | | - return model; |
152 | | - } |
153 | | - |
154 | | - /** |
155 | | - * Gets the language. |
156 | | - * |
157 | | - * If provided, then do not attempt to detect the language of the input document. Instead, assume the language is the |
158 | | - * one specified in this field. You can set this property to work around `unsupported-text-language` errors. Supported |
159 | | - * languages include English, German, French, Italian, Portuguese, Russian, Spanish and Swedish. Supported language |
160 | | - * codes are the ISO-639-1, ISO-639-2, ISO-639-3, and the plain english name of the language (for example "russian"). |
161 | | - * |
162 | | - * @return the language |
163 | | - */ |
164 | | - public String getLanguage() { |
165 | | - return language; |
166 | | - } |
167 | | - |
168 | | - /** |
169 | | - * Sets the extract. |
170 | | - * |
171 | | - * @param extract the new extract |
172 | | - */ |
173 | | - public void setExtract(final List<String> extract) { |
174 | | - this.extract = extract; |
175 | | - } |
176 | | - |
177 | | - /** |
178 | | - * Sets the sentiment. |
179 | | - * |
180 | | - * @param sentiment the new sentiment |
181 | | - */ |
182 | | - public void setSentiment(final Boolean sentiment) { |
183 | | - this.sentiment = sentiment; |
184 | | - } |
185 | | - |
186 | | - /** |
187 | | - * Sets the quotations. |
188 | | - * |
189 | | - * @param quotations the new quotations |
190 | | - */ |
191 | | - public void setQuotations(final Boolean quotations) { |
192 | | - this.quotations = quotations; |
193 | | - } |
194 | | - |
195 | | - /** |
196 | | - * Sets the showSourceText. |
197 | | - * |
198 | | - * @param showSourceText the new showSourceText |
199 | | - */ |
200 | | - public void setShowSourceText(final Boolean showSourceText) { |
201 | | - this.showSourceText = showSourceText; |
202 | | - } |
203 | | - |
204 | | - /** |
205 | | - * Sets the hierarchicalTypedRelations. |
206 | | - * |
207 | | - * @param hierarchicalTypedRelations the new hierarchicalTypedRelations |
208 | | - */ |
209 | | - public void setHierarchicalTypedRelations(final Boolean hierarchicalTypedRelations) { |
210 | | - this.hierarchicalTypedRelations = hierarchicalTypedRelations; |
211 | | - } |
212 | | - |
213 | | - /** |
214 | | - * Sets the model. |
215 | | - * |
216 | | - * @param model the new model |
217 | | - */ |
218 | | - public void setModel(final String model) { |
219 | | - this.model = model; |
220 | | - } |
221 | | - |
222 | | - /** |
223 | | - * Sets the language. |
| 77 | + * An object representing the enrichment features that will be applied to the specified field. |
224 | 78 | * |
225 | | - * @param language the new language |
| 79 | + * @return the features |
226 | 80 | */ |
227 | | - public void setLanguage(final String language) { |
228 | | - this.language = language; |
| 81 | + public NluEnrichmentFeatures features() { |
| 82 | + return features; |
229 | 83 | } |
230 | 84 | } |
0 commit comments