@@ -28,7 +28,7 @@ const BaseService = require('../lib/base_service');
28
28
function NaturalLanguageUnderstandingV1 ( options ) {
29
29
BaseService . call ( this , options ) ;
30
30
if ( typeof this . _options . version_date === 'undefined' ) {
31
- throw new Error ( 'Argument error: version_date was not specified, use NaturalLanguageUnderstandingV1.VERSION_DATE_2016_01_23 ' ) ;
31
+ throw new Error ( 'Argument error: version_date was not specified, use NaturalLanguageUnderstandingV1.VERSION_DATE_2017_02_27 ' ) ;
32
32
}
33
33
this . _options . qs . version = this . _options . version_date ;
34
34
}
@@ -37,32 +37,39 @@ NaturalLanguageUnderstandingV1.prototype.name = 'natural_language_understanding'
37
37
NaturalLanguageUnderstandingV1 . prototype . version = 'v1' ;
38
38
NaturalLanguageUnderstandingV1 . URL = 'https://gateway.watsonplatform.net/natural-language-understanding/api' ;
39
39
NaturalLanguageUnderstandingV1 . VERSION_DATE_2016_01_23 = '2016-01-23' ;
40
+ // GA version date: 2017-02-27
41
+ // https://www.ibm.com/watson/developercloud/doc/natural-language-understanding/release-notes.html
42
+ NaturalLanguageUnderstandingV1 . VERSION_DATE_2017_02_27 = '2017-02-27' ;
40
43
41
44
/**
42
45
* Analyze the query.
43
46
* @params {object} params for the query
44
- * @param {Object } [params.headers] - The headers added
47
+ * @param {object } [params.headers] - The headers added
45
48
* @param {string } [params.text] - The text to analyze.
46
49
* @param {string } [params.html] - The html to analyze.
47
50
* @param {string } [params.url] - The url to fetch and analyze.
48
51
* @param {object } [params.features] - The features to retrieve (need at least one)
49
- * @param {object } [params.features.concepts] - The concepts feature
50
- * @param {object } [params.features.entities] - The entities feature
51
- * @param {object } [params.features.keywords] - keywords feature
52
52
* @param {object } [params.features.categories] - categories feature
53
+ * @param {object } [params.features.concepts] - concepts feature
53
54
* @param {object } [params.features.emotion] - emotion feature
54
- * @param {object } [params.features.sentiment] - sentiment feature
55
+ * @param {object } [params.features.entities] - entities feature
56
+ * @param {object } [params.features.keywords] - keywords feature
57
+ * @param {object } [params.features.metadata] - metadata feature
55
58
* @param {object } [params.features.relations] - relations feature
56
59
* @param {object } [params.features.semantic_roles] - semantic roles feature
60
+ * @param {object } [params.features.sentiment] - sentiment feature
57
61
* @params {function} callback taking (error, jsonResult)
58
62
* @example
59
63
* ```
60
- * const options = { 'text': 'I am some text to analyze, am I not cool?',
61
- * 'features': {
62
- * 'concepts': {},
63
- * 'emotion': {},
64
- * },
65
- * };
64
+ * const options = {
65
+ * 'text': 'Natural Language Understanding analyzes unstructured text to return structured insights',
66
+ * 'features': {
67
+ * 'concepts': {
68
+ * 'limit': 3
69
+ * },
70
+ * 'emotion': {},
71
+ * },
72
+ * };
66
73
* nlu.analyze(options, myCallbackFunction);
67
74
* ```
68
75
* @return {void }
@@ -80,4 +87,56 @@ NaturalLanguageUnderstandingV1.prototype.analyze = function(params, callback) {
80
87
return requestFactory ( parameters , callback ) ;
81
88
} ;
82
89
90
+ /**
91
+ * List custom models deployed to your service instance.
92
+ * @params {object} params for the query
93
+ * @param {object } [params.headers] - The headers added
94
+ * @params {function} callback taking (error, jsonResult)
95
+ * @example
96
+ * ```
97
+ * nlu.listModels({}, myCallbackFunction);
98
+ * ```
99
+ * @return {void }
100
+ */
101
+ NaturalLanguageUnderstandingV1 . prototype . listModels = function ( params , callback ) {
102
+ const parameters = {
103
+ options : {
104
+ url : '/v1/models' ,
105
+ method : 'GET' ,
106
+ json : true
107
+ } ,
108
+ defaultOptions : this . _options
109
+ } ;
110
+ return requestFactory ( parameters , callback ) ;
111
+ } ;
112
+
113
+ /**
114
+ * Delete a custom model that is deployed to your service instance.
115
+ * @params {object} params for the query
116
+ * @param {object } [params.headers] - The headers added
117
+ * @param {string } [params.model_id] - ID of the custom model to delete
118
+ * @params {function} callback taking (error, jsonResult)
119
+ * @example
120
+ * ```
121
+ * const options = {
122
+ * 'model_id': 'myModel123'
123
+ * };
124
+ * nlu.deleteModel(options, myCallbackFunction);
125
+ * ```
126
+ * @return {void }
127
+ */
128
+ NaturalLanguageUnderstandingV1 . prototype . deleteModel = function ( params , callback ) {
129
+ const parameters = {
130
+ options : {
131
+ method : 'DELETE' ,
132
+ url : '/v1/models/{model_id}' ,
133
+ path : params ,
134
+ json : true
135
+ } ,
136
+ requiredParams : [ 'model_id' ] ,
137
+ defaultOptions : this . _options
138
+ } ;
139
+ return requestFactory ( parameters , callback ) ;
140
+ } ;
141
+
83
142
module . exports = NaturalLanguageUnderstandingV1 ;
0 commit comments