@ccmaymay/concrete 4.15.0 → 4.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ActiveLearnerClientService.js +249 -249
- package/ActiveLearnerServerService.js +642 -642
- package/AnnotateCommunicationService.js +696 -696
- package/AnnotateWithContextService.js +298 -298
- package/FeedbackService.js +750 -750
- package/FetchCommunicationService.js +709 -709
- package/README.md +125 -0
- package/ResultsServerService.js +2138 -2138
- package/SearchProxyService.js +962 -962
- package/SearchService.js +685 -685
- package/Service.js +373 -373
- package/StoreCommunicationService.js +255 -255
- package/SummarizationService.js +479 -479
- package/access_types.js +168 -168
- package/annotate_types.js +26 -26
- package/audio_types.js +110 -110
- package/cluster_types.js +398 -398
- package/communication_fu.js +432 -432
- package/communication_types.js +845 -845
- package/concrete.js +64 -64
- package/context_types.js +65 -65
- package/email_types.js +477 -477
- package/entities_types.js +658 -658
- package/ex_types.js +82 -82
- package/language_types.js +123 -123
- package/learn_types.js +207 -207
- package/linking_types.js +286 -286
- package/metadata_types.js +926 -926
- package/nitf_types.js +1005 -1005
- package/package.json +26 -5
- package/results_types.js +18 -18
- package/search_types.js +661 -661
- package/services_types.js +384 -384
- package/situations_types.js +1268 -1268
- package/spans_types.js +151 -151
- package/structure_types.js +2311 -2311
- package/summarization_types.js +433 -433
- package/tokenization_fu.js +33 -33
- package/tokentagging_fu.js +241 -241
- package/twitter_types.js +1553 -1553
- package/util.js +117 -117
- package/uuid_types.js +67 -67
package/search_types.js
CHANGED
@@ -1,661 +1,661 @@
|
|
1
|
-
//
|
2
|
-
// Autogenerated by Thrift Compiler (0.15.0)
|
3
|
-
//
|
4
|
-
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
-
//
|
6
|
-
"use strict";
|
7
|
-
|
8
|
-
const thrift = require('thrift');
|
9
|
-
const Thrift = thrift.Thrift;
|
10
|
-
const Int64 = require('node-int64');
|
11
|
-
|
12
|
-
const communication_ttypes = require('./communication_types');
|
13
|
-
const services_ttypes = require('./services_types');
|
14
|
-
const structure_ttypes = require('./structure_types');
|
15
|
-
const uuid_ttypes = require('./uuid_types');
|
16
|
-
const metadata_ttypes = require('./metadata_types');
|
17
|
-
const entities_ttypes = require('./entities_types');
|
18
|
-
|
19
|
-
|
20
|
-
const ttypes = module.exports = {};
|
21
|
-
ttypes.SearchType = {
|
22
|
-
'COMMUNICATIONS' : 0,
|
23
|
-
'SECTIONS' : 1,
|
24
|
-
'SENTENCES' : 2,
|
25
|
-
'ENTITIES' : 3,
|
26
|
-
'ENTITY_MENTIONS' : 4,
|
27
|
-
'SITUATIONS' : 5,
|
28
|
-
'SITUATION_MENTIONS' : 6
|
29
|
-
};
|
30
|
-
ttypes.SearchFeedback = {
|
31
|
-
'NEGATIVE' : -1,
|
32
|
-
'NONE' : 0,
|
33
|
-
'POSITIVE' : 1
|
34
|
-
};
|
35
|
-
const SearchCapability = module.exports.SearchCapability = class {
|
36
|
-
constructor(args) {
|
37
|
-
this.type = null;
|
38
|
-
this.lang = null;
|
39
|
-
if (args) {
|
40
|
-
if (args.type !== undefined && args.type !== null) {
|
41
|
-
this.type = args.type;
|
42
|
-
} else {
|
43
|
-
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field type is unset!');
|
44
|
-
}
|
45
|
-
if (args.lang !== undefined && args.lang !== null) {
|
46
|
-
this.lang = args.lang;
|
47
|
-
} else {
|
48
|
-
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field lang is unset!');
|
49
|
-
}
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
|
-
read (input) {
|
54
|
-
input.readStructBegin();
|
55
|
-
while (true) {
|
56
|
-
const ret = input.readFieldBegin();
|
57
|
-
const ftype = ret.ftype;
|
58
|
-
const fid = ret.fid;
|
59
|
-
if (ftype == Thrift.Type.STOP) {
|
60
|
-
break;
|
61
|
-
}
|
62
|
-
switch (fid) {
|
63
|
-
case 1:
|
64
|
-
if (ftype == Thrift.Type.I32) {
|
65
|
-
this.type = input.readI32();
|
66
|
-
} else {
|
67
|
-
input.skip(ftype);
|
68
|
-
}
|
69
|
-
break;
|
70
|
-
case 2:
|
71
|
-
if (ftype == Thrift.Type.STRING) {
|
72
|
-
this.lang = input.readString();
|
73
|
-
} else {
|
74
|
-
input.skip(ftype);
|
75
|
-
}
|
76
|
-
break;
|
77
|
-
default:
|
78
|
-
input.skip(ftype);
|
79
|
-
}
|
80
|
-
input.readFieldEnd();
|
81
|
-
}
|
82
|
-
input.readStructEnd();
|
83
|
-
return;
|
84
|
-
}
|
85
|
-
|
86
|
-
write (output) {
|
87
|
-
output.writeStructBegin('SearchCapability');
|
88
|
-
if (this.type !== null && this.type !== undefined) {
|
89
|
-
output.writeFieldBegin('type', Thrift.Type.I32, 1);
|
90
|
-
output.writeI32(this.type);
|
91
|
-
output.writeFieldEnd();
|
92
|
-
}
|
93
|
-
if (this.lang !== null && this.lang !== undefined) {
|
94
|
-
output.writeFieldBegin('lang', Thrift.Type.STRING, 2);
|
95
|
-
output.writeString(this.lang);
|
96
|
-
output.writeFieldEnd();
|
97
|
-
}
|
98
|
-
output.writeFieldStop();
|
99
|
-
output.writeStructEnd();
|
100
|
-
return;
|
101
|
-
}
|
102
|
-
|
103
|
-
};
|
104
|
-
const SearchQuery = module.exports.SearchQuery = class {
|
105
|
-
constructor(args) {
|
106
|
-
this.terms = null;
|
107
|
-
this.questions = null;
|
108
|
-
this.communicationId = null;
|
109
|
-
this.tokens = null;
|
110
|
-
this.rawQuery = null;
|
111
|
-
this.auths = null;
|
112
|
-
this.userId = null;
|
113
|
-
this.name = null;
|
114
|
-
this.labels = null;
|
115
|
-
this.type = null;
|
116
|
-
this.lang = null;
|
117
|
-
this.corpus = null;
|
118
|
-
this.k = null;
|
119
|
-
this.communication = null;
|
120
|
-
if (args) {
|
121
|
-
if (args.terms !== undefined && args.terms !== null) {
|
122
|
-
this.terms = Thrift.copyList(args.terms, [null]);
|
123
|
-
}
|
124
|
-
if (args.questions !== undefined && args.questions !== null) {
|
125
|
-
this.questions = Thrift.copyList(args.questions, [null]);
|
126
|
-
}
|
127
|
-
if (args.communicationId !== undefined && args.communicationId !== null) {
|
128
|
-
this.communicationId = args.communicationId;
|
129
|
-
}
|
130
|
-
if (args.tokens !== undefined && args.tokens !== null) {
|
131
|
-
this.tokens = new structure_ttypes.TokenRefSequence(args.tokens);
|
132
|
-
}
|
133
|
-
if (args.rawQuery !== undefined && args.rawQuery !== null) {
|
134
|
-
this.rawQuery = args.rawQuery;
|
135
|
-
}
|
136
|
-
if (args.auths !== undefined && args.auths !== null) {
|
137
|
-
this.auths = args.auths;
|
138
|
-
}
|
139
|
-
if (args.userId !== undefined && args.userId !== null) {
|
140
|
-
this.userId = args.userId;
|
141
|
-
}
|
142
|
-
if (args.name !== undefined && args.name !== null) {
|
143
|
-
this.name = args.name;
|
144
|
-
}
|
145
|
-
if (args.labels !== undefined && args.labels !== null) {
|
146
|
-
this.labels = Thrift.copyList(args.labels, [null]);
|
147
|
-
}
|
148
|
-
if (args.type !== undefined && args.type !== null) {
|
149
|
-
this.type = args.type;
|
150
|
-
} else {
|
151
|
-
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field type is unset!');
|
152
|
-
}
|
153
|
-
if (args.lang !== undefined && args.lang !== null) {
|
154
|
-
this.lang = args.lang;
|
155
|
-
}
|
156
|
-
if (args.corpus !== undefined && args.corpus !== null) {
|
157
|
-
this.corpus = args.corpus;
|
158
|
-
}
|
159
|
-
if (args.k !== undefined && args.k !== null) {
|
160
|
-
this.k = args.k;
|
161
|
-
}
|
162
|
-
if (args.communication !== undefined && args.communication !== null) {
|
163
|
-
this.communication = new communication_ttypes.Communication(args.communication);
|
164
|
-
}
|
165
|
-
}
|
166
|
-
}
|
167
|
-
|
168
|
-
read (input) {
|
169
|
-
input.readStructBegin();
|
170
|
-
while (true) {
|
171
|
-
const ret = input.readFieldBegin();
|
172
|
-
const ftype = ret.ftype;
|
173
|
-
const fid = ret.fid;
|
174
|
-
if (ftype == Thrift.Type.STOP) {
|
175
|
-
break;
|
176
|
-
}
|
177
|
-
switch (fid) {
|
178
|
-
case 1:
|
179
|
-
if (ftype == Thrift.Type.LIST) {
|
180
|
-
this.terms = [];
|
181
|
-
const _rtmp31 = input.readListBegin();
|
182
|
-
const _size0 = _rtmp31.size || 0;
|
183
|
-
for (let _i2 = 0; _i2 < _size0; ++_i2) {
|
184
|
-
let elem3 = null;
|
185
|
-
elem3 = input.readString();
|
186
|
-
this.terms.push(elem3);
|
187
|
-
}
|
188
|
-
input.readListEnd();
|
189
|
-
} else {
|
190
|
-
input.skip(ftype);
|
191
|
-
}
|
192
|
-
break;
|
193
|
-
case 2:
|
194
|
-
if (ftype == Thrift.Type.LIST) {
|
195
|
-
this.questions = [];
|
196
|
-
const _rtmp35 = input.readListBegin();
|
197
|
-
const _size4 = _rtmp35.size || 0;
|
198
|
-
for (let _i6 = 0; _i6 < _size4; ++_i6) {
|
199
|
-
let elem7 = null;
|
200
|
-
elem7 = input.readString();
|
201
|
-
this.questions.push(elem7);
|
202
|
-
}
|
203
|
-
input.readListEnd();
|
204
|
-
} else {
|
205
|
-
input.skip(ftype);
|
206
|
-
}
|
207
|
-
break;
|
208
|
-
case 3:
|
209
|
-
if (ftype == Thrift.Type.STRING) {
|
210
|
-
this.communicationId = input.readString();
|
211
|
-
} else {
|
212
|
-
input.skip(ftype);
|
213
|
-
}
|
214
|
-
break;
|
215
|
-
case 4:
|
216
|
-
if (ftype == Thrift.Type.STRUCT) {
|
217
|
-
this.tokens = new structure_ttypes.TokenRefSequence();
|
218
|
-
this.tokens.read(input);
|
219
|
-
} else {
|
220
|
-
input.skip(ftype);
|
221
|
-
}
|
222
|
-
break;
|
223
|
-
case 5:
|
224
|
-
if (ftype == Thrift.Type.STRING) {
|
225
|
-
this.rawQuery = input.readString();
|
226
|
-
} else {
|
227
|
-
input.skip(ftype);
|
228
|
-
}
|
229
|
-
break;
|
230
|
-
case 6:
|
231
|
-
if (ftype == Thrift.Type.STRING) {
|
232
|
-
this.auths = input.readString();
|
233
|
-
} else {
|
234
|
-
input.skip(ftype);
|
235
|
-
}
|
236
|
-
break;
|
237
|
-
case 7:
|
238
|
-
if (ftype == Thrift.Type.STRING) {
|
239
|
-
this.userId = input.readString();
|
240
|
-
} else {
|
241
|
-
input.skip(ftype);
|
242
|
-
}
|
243
|
-
break;
|
244
|
-
case 8:
|
245
|
-
if (ftype == Thrift.Type.STRING) {
|
246
|
-
this.name = input.readString();
|
247
|
-
} else {
|
248
|
-
input.skip(ftype);
|
249
|
-
}
|
250
|
-
break;
|
251
|
-
case 9:
|
252
|
-
if (ftype == Thrift.Type.LIST) {
|
253
|
-
this.labels = [];
|
254
|
-
const _rtmp39 = input.readListBegin();
|
255
|
-
const _size8 = _rtmp39.size || 0;
|
256
|
-
for (let _i10 = 0; _i10 < _size8; ++_i10) {
|
257
|
-
let elem11 = null;
|
258
|
-
elem11 = input.readString();
|
259
|
-
this.labels.push(elem11);
|
260
|
-
}
|
261
|
-
input.readListEnd();
|
262
|
-
} else {
|
263
|
-
input.skip(ftype);
|
264
|
-
}
|
265
|
-
break;
|
266
|
-
case 10:
|
267
|
-
if (ftype == Thrift.Type.I32) {
|
268
|
-
this.type = input.readI32();
|
269
|
-
} else {
|
270
|
-
input.skip(ftype);
|
271
|
-
}
|
272
|
-
break;
|
273
|
-
case 11:
|
274
|
-
if (ftype == Thrift.Type.STRING) {
|
275
|
-
this.lang = input.readString();
|
276
|
-
} else {
|
277
|
-
input.skip(ftype);
|
278
|
-
}
|
279
|
-
break;
|
280
|
-
case 12:
|
281
|
-
if (ftype == Thrift.Type.STRING) {
|
282
|
-
this.corpus = input.readString();
|
283
|
-
} else {
|
284
|
-
input.skip(ftype);
|
285
|
-
}
|
286
|
-
break;
|
287
|
-
case 13:
|
288
|
-
if (ftype == Thrift.Type.I32) {
|
289
|
-
this.k = input.readI32();
|
290
|
-
} else {
|
291
|
-
input.skip(ftype);
|
292
|
-
}
|
293
|
-
break;
|
294
|
-
case 14:
|
295
|
-
if (ftype == Thrift.Type.STRUCT) {
|
296
|
-
this.communication = new communication_ttypes.Communication();
|
297
|
-
this.communication.read(input);
|
298
|
-
} else {
|
299
|
-
input.skip(ftype);
|
300
|
-
}
|
301
|
-
break;
|
302
|
-
default:
|
303
|
-
input.skip(ftype);
|
304
|
-
}
|
305
|
-
input.readFieldEnd();
|
306
|
-
}
|
307
|
-
input.readStructEnd();
|
308
|
-
return;
|
309
|
-
}
|
310
|
-
|
311
|
-
write (output) {
|
312
|
-
output.writeStructBegin('SearchQuery');
|
313
|
-
if (this.terms !== null && this.terms !== undefined) {
|
314
|
-
output.writeFieldBegin('terms', Thrift.Type.LIST, 1);
|
315
|
-
output.writeListBegin(Thrift.Type.STRING, this.terms.length);
|
316
|
-
for (let iter12 in this.terms) {
|
317
|
-
if (this.terms.hasOwnProperty(iter12)) {
|
318
|
-
iter12 = this.terms[iter12];
|
319
|
-
output.writeString(iter12);
|
320
|
-
}
|
321
|
-
}
|
322
|
-
output.writeListEnd();
|
323
|
-
output.writeFieldEnd();
|
324
|
-
}
|
325
|
-
if (this.questions !== null && this.questions !== undefined) {
|
326
|
-
output.writeFieldBegin('questions', Thrift.Type.LIST, 2);
|
327
|
-
output.writeListBegin(Thrift.Type.STRING, this.questions.length);
|
328
|
-
for (let iter13 in this.questions) {
|
329
|
-
if (this.questions.hasOwnProperty(iter13)) {
|
330
|
-
iter13 = this.questions[iter13];
|
331
|
-
output.writeString(iter13);
|
332
|
-
}
|
333
|
-
}
|
334
|
-
output.writeListEnd();
|
335
|
-
output.writeFieldEnd();
|
336
|
-
}
|
337
|
-
if (this.communicationId !== null && this.communicationId !== undefined) {
|
338
|
-
output.writeFieldBegin('communicationId', Thrift.Type.STRING, 3);
|
339
|
-
output.writeString(this.communicationId);
|
340
|
-
output.writeFieldEnd();
|
341
|
-
}
|
342
|
-
if (this.tokens !== null && this.tokens !== undefined) {
|
343
|
-
output.writeFieldBegin('tokens', Thrift.Type.STRUCT, 4);
|
344
|
-
this.tokens.write(output);
|
345
|
-
output.writeFieldEnd();
|
346
|
-
}
|
347
|
-
if (this.rawQuery !== null && this.rawQuery !== undefined) {
|
348
|
-
output.writeFieldBegin('rawQuery', Thrift.Type.STRING, 5);
|
349
|
-
output.writeString(this.rawQuery);
|
350
|
-
output.writeFieldEnd();
|
351
|
-
}
|
352
|
-
if (this.auths !== null && this.auths !== undefined) {
|
353
|
-
output.writeFieldBegin('auths', Thrift.Type.STRING, 6);
|
354
|
-
output.writeString(this.auths);
|
355
|
-
output.writeFieldEnd();
|
356
|
-
}
|
357
|
-
if (this.userId !== null && this.userId !== undefined) {
|
358
|
-
output.writeFieldBegin('userId', Thrift.Type.STRING, 7);
|
359
|
-
output.writeString(this.userId);
|
360
|
-
output.writeFieldEnd();
|
361
|
-
}
|
362
|
-
if (this.name !== null && this.name !== undefined) {
|
363
|
-
output.writeFieldBegin('name', Thrift.Type.STRING, 8);
|
364
|
-
output.writeString(this.name);
|
365
|
-
output.writeFieldEnd();
|
366
|
-
}
|
367
|
-
if (this.labels !== null && this.labels !== undefined) {
|
368
|
-
output.writeFieldBegin('labels', Thrift.Type.LIST, 9);
|
369
|
-
output.writeListBegin(Thrift.Type.STRING, this.labels.length);
|
370
|
-
for (let iter14 in this.labels) {
|
371
|
-
if (this.labels.hasOwnProperty(iter14)) {
|
372
|
-
iter14 = this.labels[iter14];
|
373
|
-
output.writeString(iter14);
|
374
|
-
}
|
375
|
-
}
|
376
|
-
output.writeListEnd();
|
377
|
-
output.writeFieldEnd();
|
378
|
-
}
|
379
|
-
if (this.type !== null && this.type !== undefined) {
|
380
|
-
output.writeFieldBegin('type', Thrift.Type.I32, 10);
|
381
|
-
output.writeI32(this.type);
|
382
|
-
output.writeFieldEnd();
|
383
|
-
}
|
384
|
-
if (this.lang !== null && this.lang !== undefined) {
|
385
|
-
output.writeFieldBegin('lang', Thrift.Type.STRING, 11);
|
386
|
-
output.writeString(this.lang);
|
387
|
-
output.writeFieldEnd();
|
388
|
-
}
|
389
|
-
if (this.corpus !== null && this.corpus !== undefined) {
|
390
|
-
output.writeFieldBegin('corpus', Thrift.Type.STRING, 12);
|
391
|
-
output.writeString(this.corpus);
|
392
|
-
output.writeFieldEnd();
|
393
|
-
}
|
394
|
-
if (this.k !== null && this.k !== undefined) {
|
395
|
-
output.writeFieldBegin('k', Thrift.Type.I32, 13);
|
396
|
-
output.writeI32(this.k);
|
397
|
-
output.writeFieldEnd();
|
398
|
-
}
|
399
|
-
if (this.communication !== null && this.communication !== undefined) {
|
400
|
-
output.writeFieldBegin('communication', Thrift.Type.STRUCT, 14);
|
401
|
-
this.communication.write(output);
|
402
|
-
output.writeFieldEnd();
|
403
|
-
}
|
404
|
-
output.writeFieldStop();
|
405
|
-
output.writeStructEnd();
|
406
|
-
return;
|
407
|
-
}
|
408
|
-
|
409
|
-
};
|
410
|
-
const SearchResultItem = module.exports.SearchResultItem = class {
|
411
|
-
constructor(args) {
|
412
|
-
this.communicationId = null;
|
413
|
-
this.sentenceId = null;
|
414
|
-
this.score = null;
|
415
|
-
this.tokens = null;
|
416
|
-
this.entity = null;
|
417
|
-
if (args) {
|
418
|
-
if (args.communicationId !== undefined && args.communicationId !== null) {
|
419
|
-
this.communicationId = args.communicationId;
|
420
|
-
}
|
421
|
-
if (args.sentenceId !== undefined && args.sentenceId !== null) {
|
422
|
-
this.sentenceId = new uuid_ttypes.UUID(args.sentenceId);
|
423
|
-
}
|
424
|
-
if (args.score !== undefined && args.score !== null) {
|
425
|
-
this.score = args.score;
|
426
|
-
}
|
427
|
-
if (args.tokens !== undefined && args.tokens !== null) {
|
428
|
-
this.tokens = new structure_ttypes.TokenRefSequence(args.tokens);
|
429
|
-
}
|
430
|
-
if (args.entity !== undefined && args.entity !== null) {
|
431
|
-
this.entity = new entities_ttypes.Entity(args.entity);
|
432
|
-
}
|
433
|
-
}
|
434
|
-
}
|
435
|
-
|
436
|
-
read (input) {
|
437
|
-
input.readStructBegin();
|
438
|
-
while (true) {
|
439
|
-
const ret = input.readFieldBegin();
|
440
|
-
const ftype = ret.ftype;
|
441
|
-
const fid = ret.fid;
|
442
|
-
if (ftype == Thrift.Type.STOP) {
|
443
|
-
break;
|
444
|
-
}
|
445
|
-
switch (fid) {
|
446
|
-
case 1:
|
447
|
-
if (ftype == Thrift.Type.STRING) {
|
448
|
-
this.communicationId = input.readString();
|
449
|
-
} else {
|
450
|
-
input.skip(ftype);
|
451
|
-
}
|
452
|
-
break;
|
453
|
-
case 2:
|
454
|
-
if (ftype == Thrift.Type.STRUCT) {
|
455
|
-
this.sentenceId = new uuid_ttypes.UUID();
|
456
|
-
this.sentenceId.read(input);
|
457
|
-
} else {
|
458
|
-
input.skip(ftype);
|
459
|
-
}
|
460
|
-
break;
|
461
|
-
case 3:
|
462
|
-
if (ftype == Thrift.Type.DOUBLE) {
|
463
|
-
this.score = input.readDouble();
|
464
|
-
} else {
|
465
|
-
input.skip(ftype);
|
466
|
-
}
|
467
|
-
break;
|
468
|
-
case 4:
|
469
|
-
if (ftype == Thrift.Type.STRUCT) {
|
470
|
-
this.tokens = new structure_ttypes.TokenRefSequence();
|
471
|
-
this.tokens.read(input);
|
472
|
-
} else {
|
473
|
-
input.skip(ftype);
|
474
|
-
}
|
475
|
-
break;
|
476
|
-
case 5:
|
477
|
-
if (ftype == Thrift.Type.STRUCT) {
|
478
|
-
this.entity = new entities_ttypes.Entity();
|
479
|
-
this.entity.read(input);
|
480
|
-
} else {
|
481
|
-
input.skip(ftype);
|
482
|
-
}
|
483
|
-
break;
|
484
|
-
default:
|
485
|
-
input.skip(ftype);
|
486
|
-
}
|
487
|
-
input.readFieldEnd();
|
488
|
-
}
|
489
|
-
input.readStructEnd();
|
490
|
-
return;
|
491
|
-
}
|
492
|
-
|
493
|
-
write (output) {
|
494
|
-
output.writeStructBegin('SearchResultItem');
|
495
|
-
if (this.communicationId !== null && this.communicationId !== undefined) {
|
496
|
-
output.writeFieldBegin('communicationId', Thrift.Type.STRING, 1);
|
497
|
-
output.writeString(this.communicationId);
|
498
|
-
output.writeFieldEnd();
|
499
|
-
}
|
500
|
-
if (this.sentenceId !== null && this.sentenceId !== undefined) {
|
501
|
-
output.writeFieldBegin('sentenceId', Thrift.Type.STRUCT, 2);
|
502
|
-
this.sentenceId.write(output);
|
503
|
-
output.writeFieldEnd();
|
504
|
-
}
|
505
|
-
if (this.score !== null && this.score !== undefined) {
|
506
|
-
output.writeFieldBegin('score', Thrift.Type.DOUBLE, 3);
|
507
|
-
output.writeDouble(this.score);
|
508
|
-
output.writeFieldEnd();
|
509
|
-
}
|
510
|
-
if (this.tokens !== null && this.tokens !== undefined) {
|
511
|
-
output.writeFieldBegin('tokens', Thrift.Type.STRUCT, 4);
|
512
|
-
this.tokens.write(output);
|
513
|
-
output.writeFieldEnd();
|
514
|
-
}
|
515
|
-
if (this.entity !== null && this.entity !== undefined) {
|
516
|
-
output.writeFieldBegin('entity', Thrift.Type.STRUCT, 5);
|
517
|
-
this.entity.write(output);
|
518
|
-
output.writeFieldEnd();
|
519
|
-
}
|
520
|
-
output.writeFieldStop();
|
521
|
-
output.writeStructEnd();
|
522
|
-
return;
|
523
|
-
}
|
524
|
-
|
525
|
-
};
|
526
|
-
const SearchResult = module.exports.SearchResult = class {
|
527
|
-
constructor(args) {
|
528
|
-
this.uuid = null;
|
529
|
-
this.searchQuery = null;
|
530
|
-
this.searchResultItems = null;
|
531
|
-
this.metadata = null;
|
532
|
-
this.lang = null;
|
533
|
-
if (args) {
|
534
|
-
if (args.uuid !== undefined && args.uuid !== null) {
|
535
|
-
this.uuid = new uuid_ttypes.UUID(args.uuid);
|
536
|
-
} else {
|
537
|
-
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field uuid is unset!');
|
538
|
-
}
|
539
|
-
if (args.searchQuery !== undefined && args.searchQuery !== null) {
|
540
|
-
this.searchQuery = new ttypes.SearchQuery(args.searchQuery);
|
541
|
-
} else {
|
542
|
-
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field searchQuery is unset!');
|
543
|
-
}
|
544
|
-
if (args.searchResultItems !== undefined && args.searchResultItems !== null) {
|
545
|
-
this.searchResultItems = Thrift.copyList(args.searchResultItems, [ttypes.SearchResultItem]);
|
546
|
-
}
|
547
|
-
if (args.metadata !== undefined && args.metadata !== null) {
|
548
|
-
this.metadata = new metadata_ttypes.AnnotationMetadata(args.metadata);
|
549
|
-
}
|
550
|
-
if (args.lang !== undefined && args.lang !== null) {
|
551
|
-
this.lang = args.lang;
|
552
|
-
}
|
553
|
-
}
|
554
|
-
}
|
555
|
-
|
556
|
-
read (input) {
|
557
|
-
input.readStructBegin();
|
558
|
-
while (true) {
|
559
|
-
const ret = input.readFieldBegin();
|
560
|
-
const ftype = ret.ftype;
|
561
|
-
const fid = ret.fid;
|
562
|
-
if (ftype == Thrift.Type.STOP) {
|
563
|
-
break;
|
564
|
-
}
|
565
|
-
switch (fid) {
|
566
|
-
case 1:
|
567
|
-
if (ftype == Thrift.Type.STRUCT) {
|
568
|
-
this.uuid = new uuid_ttypes.UUID();
|
569
|
-
this.uuid.read(input);
|
570
|
-
} else {
|
571
|
-
input.skip(ftype);
|
572
|
-
}
|
573
|
-
break;
|
574
|
-
case 2:
|
575
|
-
if (ftype == Thrift.Type.STRUCT) {
|
576
|
-
this.searchQuery = new ttypes.SearchQuery();
|
577
|
-
this.searchQuery.read(input);
|
578
|
-
} else {
|
579
|
-
input.skip(ftype);
|
580
|
-
}
|
581
|
-
break;
|
582
|
-
case 3:
|
583
|
-
if (ftype == Thrift.Type.LIST) {
|
584
|
-
this.searchResultItems = [];
|
585
|
-
const _rtmp316 = input.readListBegin();
|
586
|
-
const _size15 = _rtmp316.size || 0;
|
587
|
-
for (let _i17 = 0; _i17 < _size15; ++_i17) {
|
588
|
-
let elem18 = null;
|
589
|
-
elem18 = new ttypes.SearchResultItem();
|
590
|
-
elem18.read(input);
|
591
|
-
this.searchResultItems.push(elem18);
|
592
|
-
}
|
593
|
-
input.readListEnd();
|
594
|
-
} else {
|
595
|
-
input.skip(ftype);
|
596
|
-
}
|
597
|
-
break;
|
598
|
-
case 4:
|
599
|
-
if (ftype == Thrift.Type.STRUCT) {
|
600
|
-
this.metadata = new metadata_ttypes.AnnotationMetadata();
|
601
|
-
this.metadata.read(input);
|
602
|
-
} else {
|
603
|
-
input.skip(ftype);
|
604
|
-
}
|
605
|
-
break;
|
606
|
-
case 5:
|
607
|
-
if (ftype == Thrift.Type.STRING) {
|
608
|
-
this.lang = input.readString();
|
609
|
-
} else {
|
610
|
-
input.skip(ftype);
|
611
|
-
}
|
612
|
-
break;
|
613
|
-
default:
|
614
|
-
input.skip(ftype);
|
615
|
-
}
|
616
|
-
input.readFieldEnd();
|
617
|
-
}
|
618
|
-
input.readStructEnd();
|
619
|
-
return;
|
620
|
-
}
|
621
|
-
|
622
|
-
write (output) {
|
623
|
-
output.writeStructBegin('SearchResult');
|
624
|
-
if (this.uuid !== null && this.uuid !== undefined) {
|
625
|
-
output.writeFieldBegin('uuid', Thrift.Type.STRUCT, 1);
|
626
|
-
this.uuid.write(output);
|
627
|
-
output.writeFieldEnd();
|
628
|
-
}
|
629
|
-
if (this.searchQuery !== null && this.searchQuery !== undefined) {
|
630
|
-
output.writeFieldBegin('searchQuery', Thrift.Type.STRUCT, 2);
|
631
|
-
this.searchQuery.write(output);
|
632
|
-
output.writeFieldEnd();
|
633
|
-
}
|
634
|
-
if (this.searchResultItems !== null && this.searchResultItems !== undefined) {
|
635
|
-
output.writeFieldBegin('searchResultItems', Thrift.Type.LIST, 3);
|
636
|
-
output.writeListBegin(Thrift.Type.STRUCT, this.searchResultItems.length);
|
637
|
-
for (let iter19 in this.searchResultItems) {
|
638
|
-
if (this.searchResultItems.hasOwnProperty(iter19)) {
|
639
|
-
iter19 = this.searchResultItems[iter19];
|
640
|
-
iter19.write(output);
|
641
|
-
}
|
642
|
-
}
|
643
|
-
output.writeListEnd();
|
644
|
-
output.writeFieldEnd();
|
645
|
-
}
|
646
|
-
if (this.metadata !== null && this.metadata !== undefined) {
|
647
|
-
output.writeFieldBegin('metadata', Thrift.Type.STRUCT, 4);
|
648
|
-
this.metadata.write(output);
|
649
|
-
output.writeFieldEnd();
|
650
|
-
}
|
651
|
-
if (this.lang !== null && this.lang !== undefined) {
|
652
|
-
output.writeFieldBegin('lang', Thrift.Type.STRING, 5);
|
653
|
-
output.writeString(this.lang);
|
654
|
-
output.writeFieldEnd();
|
655
|
-
}
|
656
|
-
output.writeFieldStop();
|
657
|
-
output.writeStructEnd();
|
658
|
-
return;
|
659
|
-
}
|
660
|
-
|
661
|
-
};
|
1
|
+
//
|
2
|
+
// Autogenerated by Thrift Compiler (0.15.0)
|
3
|
+
//
|
4
|
+
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
//
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
const thrift = require('thrift');
|
9
|
+
const Thrift = thrift.Thrift;
|
10
|
+
const Int64 = require('node-int64');
|
11
|
+
|
12
|
+
const communication_ttypes = require('./communication_types');
|
13
|
+
const services_ttypes = require('./services_types');
|
14
|
+
const structure_ttypes = require('./structure_types');
|
15
|
+
const uuid_ttypes = require('./uuid_types');
|
16
|
+
const metadata_ttypes = require('./metadata_types');
|
17
|
+
const entities_ttypes = require('./entities_types');
|
18
|
+
|
19
|
+
|
20
|
+
const ttypes = module.exports = {};
|
21
|
+
ttypes.SearchType = {
|
22
|
+
'COMMUNICATIONS' : 0,
|
23
|
+
'SECTIONS' : 1,
|
24
|
+
'SENTENCES' : 2,
|
25
|
+
'ENTITIES' : 3,
|
26
|
+
'ENTITY_MENTIONS' : 4,
|
27
|
+
'SITUATIONS' : 5,
|
28
|
+
'SITUATION_MENTIONS' : 6
|
29
|
+
};
|
30
|
+
ttypes.SearchFeedback = {
|
31
|
+
'NEGATIVE' : -1,
|
32
|
+
'NONE' : 0,
|
33
|
+
'POSITIVE' : 1
|
34
|
+
};
|
35
|
+
const SearchCapability = module.exports.SearchCapability = class {
|
36
|
+
constructor(args) {
|
37
|
+
this.type = null;
|
38
|
+
this.lang = null;
|
39
|
+
if (args) {
|
40
|
+
if (args.type !== undefined && args.type !== null) {
|
41
|
+
this.type = args.type;
|
42
|
+
} else {
|
43
|
+
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field type is unset!');
|
44
|
+
}
|
45
|
+
if (args.lang !== undefined && args.lang !== null) {
|
46
|
+
this.lang = args.lang;
|
47
|
+
} else {
|
48
|
+
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field lang is unset!');
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
read (input) {
|
54
|
+
input.readStructBegin();
|
55
|
+
while (true) {
|
56
|
+
const ret = input.readFieldBegin();
|
57
|
+
const ftype = ret.ftype;
|
58
|
+
const fid = ret.fid;
|
59
|
+
if (ftype == Thrift.Type.STOP) {
|
60
|
+
break;
|
61
|
+
}
|
62
|
+
switch (fid) {
|
63
|
+
case 1:
|
64
|
+
if (ftype == Thrift.Type.I32) {
|
65
|
+
this.type = input.readI32();
|
66
|
+
} else {
|
67
|
+
input.skip(ftype);
|
68
|
+
}
|
69
|
+
break;
|
70
|
+
case 2:
|
71
|
+
if (ftype == Thrift.Type.STRING) {
|
72
|
+
this.lang = input.readString();
|
73
|
+
} else {
|
74
|
+
input.skip(ftype);
|
75
|
+
}
|
76
|
+
break;
|
77
|
+
default:
|
78
|
+
input.skip(ftype);
|
79
|
+
}
|
80
|
+
input.readFieldEnd();
|
81
|
+
}
|
82
|
+
input.readStructEnd();
|
83
|
+
return;
|
84
|
+
}
|
85
|
+
|
86
|
+
write (output) {
|
87
|
+
output.writeStructBegin('SearchCapability');
|
88
|
+
if (this.type !== null && this.type !== undefined) {
|
89
|
+
output.writeFieldBegin('type', Thrift.Type.I32, 1);
|
90
|
+
output.writeI32(this.type);
|
91
|
+
output.writeFieldEnd();
|
92
|
+
}
|
93
|
+
if (this.lang !== null && this.lang !== undefined) {
|
94
|
+
output.writeFieldBegin('lang', Thrift.Type.STRING, 2);
|
95
|
+
output.writeString(this.lang);
|
96
|
+
output.writeFieldEnd();
|
97
|
+
}
|
98
|
+
output.writeFieldStop();
|
99
|
+
output.writeStructEnd();
|
100
|
+
return;
|
101
|
+
}
|
102
|
+
|
103
|
+
};
|
104
|
+
const SearchQuery = module.exports.SearchQuery = class {
|
105
|
+
constructor(args) {
|
106
|
+
this.terms = null;
|
107
|
+
this.questions = null;
|
108
|
+
this.communicationId = null;
|
109
|
+
this.tokens = null;
|
110
|
+
this.rawQuery = null;
|
111
|
+
this.auths = null;
|
112
|
+
this.userId = null;
|
113
|
+
this.name = null;
|
114
|
+
this.labels = null;
|
115
|
+
this.type = null;
|
116
|
+
this.lang = null;
|
117
|
+
this.corpus = null;
|
118
|
+
this.k = null;
|
119
|
+
this.communication = null;
|
120
|
+
if (args) {
|
121
|
+
if (args.terms !== undefined && args.terms !== null) {
|
122
|
+
this.terms = Thrift.copyList(args.terms, [null]);
|
123
|
+
}
|
124
|
+
if (args.questions !== undefined && args.questions !== null) {
|
125
|
+
this.questions = Thrift.copyList(args.questions, [null]);
|
126
|
+
}
|
127
|
+
if (args.communicationId !== undefined && args.communicationId !== null) {
|
128
|
+
this.communicationId = args.communicationId;
|
129
|
+
}
|
130
|
+
if (args.tokens !== undefined && args.tokens !== null) {
|
131
|
+
this.tokens = new structure_ttypes.TokenRefSequence(args.tokens);
|
132
|
+
}
|
133
|
+
if (args.rawQuery !== undefined && args.rawQuery !== null) {
|
134
|
+
this.rawQuery = args.rawQuery;
|
135
|
+
}
|
136
|
+
if (args.auths !== undefined && args.auths !== null) {
|
137
|
+
this.auths = args.auths;
|
138
|
+
}
|
139
|
+
if (args.userId !== undefined && args.userId !== null) {
|
140
|
+
this.userId = args.userId;
|
141
|
+
}
|
142
|
+
if (args.name !== undefined && args.name !== null) {
|
143
|
+
this.name = args.name;
|
144
|
+
}
|
145
|
+
if (args.labels !== undefined && args.labels !== null) {
|
146
|
+
this.labels = Thrift.copyList(args.labels, [null]);
|
147
|
+
}
|
148
|
+
if (args.type !== undefined && args.type !== null) {
|
149
|
+
this.type = args.type;
|
150
|
+
} else {
|
151
|
+
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field type is unset!');
|
152
|
+
}
|
153
|
+
if (args.lang !== undefined && args.lang !== null) {
|
154
|
+
this.lang = args.lang;
|
155
|
+
}
|
156
|
+
if (args.corpus !== undefined && args.corpus !== null) {
|
157
|
+
this.corpus = args.corpus;
|
158
|
+
}
|
159
|
+
if (args.k !== undefined && args.k !== null) {
|
160
|
+
this.k = args.k;
|
161
|
+
}
|
162
|
+
if (args.communication !== undefined && args.communication !== null) {
|
163
|
+
this.communication = new communication_ttypes.Communication(args.communication);
|
164
|
+
}
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
168
|
+
read (input) {
|
169
|
+
input.readStructBegin();
|
170
|
+
while (true) {
|
171
|
+
const ret = input.readFieldBegin();
|
172
|
+
const ftype = ret.ftype;
|
173
|
+
const fid = ret.fid;
|
174
|
+
if (ftype == Thrift.Type.STOP) {
|
175
|
+
break;
|
176
|
+
}
|
177
|
+
switch (fid) {
|
178
|
+
case 1:
|
179
|
+
if (ftype == Thrift.Type.LIST) {
|
180
|
+
this.terms = [];
|
181
|
+
const _rtmp31 = input.readListBegin();
|
182
|
+
const _size0 = _rtmp31.size || 0;
|
183
|
+
for (let _i2 = 0; _i2 < _size0; ++_i2) {
|
184
|
+
let elem3 = null;
|
185
|
+
elem3 = input.readString();
|
186
|
+
this.terms.push(elem3);
|
187
|
+
}
|
188
|
+
input.readListEnd();
|
189
|
+
} else {
|
190
|
+
input.skip(ftype);
|
191
|
+
}
|
192
|
+
break;
|
193
|
+
case 2:
|
194
|
+
if (ftype == Thrift.Type.LIST) {
|
195
|
+
this.questions = [];
|
196
|
+
const _rtmp35 = input.readListBegin();
|
197
|
+
const _size4 = _rtmp35.size || 0;
|
198
|
+
for (let _i6 = 0; _i6 < _size4; ++_i6) {
|
199
|
+
let elem7 = null;
|
200
|
+
elem7 = input.readString();
|
201
|
+
this.questions.push(elem7);
|
202
|
+
}
|
203
|
+
input.readListEnd();
|
204
|
+
} else {
|
205
|
+
input.skip(ftype);
|
206
|
+
}
|
207
|
+
break;
|
208
|
+
case 3:
|
209
|
+
if (ftype == Thrift.Type.STRING) {
|
210
|
+
this.communicationId = input.readString();
|
211
|
+
} else {
|
212
|
+
input.skip(ftype);
|
213
|
+
}
|
214
|
+
break;
|
215
|
+
case 4:
|
216
|
+
if (ftype == Thrift.Type.STRUCT) {
|
217
|
+
this.tokens = new structure_ttypes.TokenRefSequence();
|
218
|
+
this.tokens.read(input);
|
219
|
+
} else {
|
220
|
+
input.skip(ftype);
|
221
|
+
}
|
222
|
+
break;
|
223
|
+
case 5:
|
224
|
+
if (ftype == Thrift.Type.STRING) {
|
225
|
+
this.rawQuery = input.readString();
|
226
|
+
} else {
|
227
|
+
input.skip(ftype);
|
228
|
+
}
|
229
|
+
break;
|
230
|
+
case 6:
|
231
|
+
if (ftype == Thrift.Type.STRING) {
|
232
|
+
this.auths = input.readString();
|
233
|
+
} else {
|
234
|
+
input.skip(ftype);
|
235
|
+
}
|
236
|
+
break;
|
237
|
+
case 7:
|
238
|
+
if (ftype == Thrift.Type.STRING) {
|
239
|
+
this.userId = input.readString();
|
240
|
+
} else {
|
241
|
+
input.skip(ftype);
|
242
|
+
}
|
243
|
+
break;
|
244
|
+
case 8:
|
245
|
+
if (ftype == Thrift.Type.STRING) {
|
246
|
+
this.name = input.readString();
|
247
|
+
} else {
|
248
|
+
input.skip(ftype);
|
249
|
+
}
|
250
|
+
break;
|
251
|
+
case 9:
|
252
|
+
if (ftype == Thrift.Type.LIST) {
|
253
|
+
this.labels = [];
|
254
|
+
const _rtmp39 = input.readListBegin();
|
255
|
+
const _size8 = _rtmp39.size || 0;
|
256
|
+
for (let _i10 = 0; _i10 < _size8; ++_i10) {
|
257
|
+
let elem11 = null;
|
258
|
+
elem11 = input.readString();
|
259
|
+
this.labels.push(elem11);
|
260
|
+
}
|
261
|
+
input.readListEnd();
|
262
|
+
} else {
|
263
|
+
input.skip(ftype);
|
264
|
+
}
|
265
|
+
break;
|
266
|
+
case 10:
|
267
|
+
if (ftype == Thrift.Type.I32) {
|
268
|
+
this.type = input.readI32();
|
269
|
+
} else {
|
270
|
+
input.skip(ftype);
|
271
|
+
}
|
272
|
+
break;
|
273
|
+
case 11:
|
274
|
+
if (ftype == Thrift.Type.STRING) {
|
275
|
+
this.lang = input.readString();
|
276
|
+
} else {
|
277
|
+
input.skip(ftype);
|
278
|
+
}
|
279
|
+
break;
|
280
|
+
case 12:
|
281
|
+
if (ftype == Thrift.Type.STRING) {
|
282
|
+
this.corpus = input.readString();
|
283
|
+
} else {
|
284
|
+
input.skip(ftype);
|
285
|
+
}
|
286
|
+
break;
|
287
|
+
case 13:
|
288
|
+
if (ftype == Thrift.Type.I32) {
|
289
|
+
this.k = input.readI32();
|
290
|
+
} else {
|
291
|
+
input.skip(ftype);
|
292
|
+
}
|
293
|
+
break;
|
294
|
+
case 14:
|
295
|
+
if (ftype == Thrift.Type.STRUCT) {
|
296
|
+
this.communication = new communication_ttypes.Communication();
|
297
|
+
this.communication.read(input);
|
298
|
+
} else {
|
299
|
+
input.skip(ftype);
|
300
|
+
}
|
301
|
+
break;
|
302
|
+
default:
|
303
|
+
input.skip(ftype);
|
304
|
+
}
|
305
|
+
input.readFieldEnd();
|
306
|
+
}
|
307
|
+
input.readStructEnd();
|
308
|
+
return;
|
309
|
+
}
|
310
|
+
|
311
|
+
write (output) {
|
312
|
+
output.writeStructBegin('SearchQuery');
|
313
|
+
if (this.terms !== null && this.terms !== undefined) {
|
314
|
+
output.writeFieldBegin('terms', Thrift.Type.LIST, 1);
|
315
|
+
output.writeListBegin(Thrift.Type.STRING, this.terms.length);
|
316
|
+
for (let iter12 in this.terms) {
|
317
|
+
if (this.terms.hasOwnProperty(iter12)) {
|
318
|
+
iter12 = this.terms[iter12];
|
319
|
+
output.writeString(iter12);
|
320
|
+
}
|
321
|
+
}
|
322
|
+
output.writeListEnd();
|
323
|
+
output.writeFieldEnd();
|
324
|
+
}
|
325
|
+
if (this.questions !== null && this.questions !== undefined) {
|
326
|
+
output.writeFieldBegin('questions', Thrift.Type.LIST, 2);
|
327
|
+
output.writeListBegin(Thrift.Type.STRING, this.questions.length);
|
328
|
+
for (let iter13 in this.questions) {
|
329
|
+
if (this.questions.hasOwnProperty(iter13)) {
|
330
|
+
iter13 = this.questions[iter13];
|
331
|
+
output.writeString(iter13);
|
332
|
+
}
|
333
|
+
}
|
334
|
+
output.writeListEnd();
|
335
|
+
output.writeFieldEnd();
|
336
|
+
}
|
337
|
+
if (this.communicationId !== null && this.communicationId !== undefined) {
|
338
|
+
output.writeFieldBegin('communicationId', Thrift.Type.STRING, 3);
|
339
|
+
output.writeString(this.communicationId);
|
340
|
+
output.writeFieldEnd();
|
341
|
+
}
|
342
|
+
if (this.tokens !== null && this.tokens !== undefined) {
|
343
|
+
output.writeFieldBegin('tokens', Thrift.Type.STRUCT, 4);
|
344
|
+
this.tokens.write(output);
|
345
|
+
output.writeFieldEnd();
|
346
|
+
}
|
347
|
+
if (this.rawQuery !== null && this.rawQuery !== undefined) {
|
348
|
+
output.writeFieldBegin('rawQuery', Thrift.Type.STRING, 5);
|
349
|
+
output.writeString(this.rawQuery);
|
350
|
+
output.writeFieldEnd();
|
351
|
+
}
|
352
|
+
if (this.auths !== null && this.auths !== undefined) {
|
353
|
+
output.writeFieldBegin('auths', Thrift.Type.STRING, 6);
|
354
|
+
output.writeString(this.auths);
|
355
|
+
output.writeFieldEnd();
|
356
|
+
}
|
357
|
+
if (this.userId !== null && this.userId !== undefined) {
|
358
|
+
output.writeFieldBegin('userId', Thrift.Type.STRING, 7);
|
359
|
+
output.writeString(this.userId);
|
360
|
+
output.writeFieldEnd();
|
361
|
+
}
|
362
|
+
if (this.name !== null && this.name !== undefined) {
|
363
|
+
output.writeFieldBegin('name', Thrift.Type.STRING, 8);
|
364
|
+
output.writeString(this.name);
|
365
|
+
output.writeFieldEnd();
|
366
|
+
}
|
367
|
+
if (this.labels !== null && this.labels !== undefined) {
|
368
|
+
output.writeFieldBegin('labels', Thrift.Type.LIST, 9);
|
369
|
+
output.writeListBegin(Thrift.Type.STRING, this.labels.length);
|
370
|
+
for (let iter14 in this.labels) {
|
371
|
+
if (this.labels.hasOwnProperty(iter14)) {
|
372
|
+
iter14 = this.labels[iter14];
|
373
|
+
output.writeString(iter14);
|
374
|
+
}
|
375
|
+
}
|
376
|
+
output.writeListEnd();
|
377
|
+
output.writeFieldEnd();
|
378
|
+
}
|
379
|
+
if (this.type !== null && this.type !== undefined) {
|
380
|
+
output.writeFieldBegin('type', Thrift.Type.I32, 10);
|
381
|
+
output.writeI32(this.type);
|
382
|
+
output.writeFieldEnd();
|
383
|
+
}
|
384
|
+
if (this.lang !== null && this.lang !== undefined) {
|
385
|
+
output.writeFieldBegin('lang', Thrift.Type.STRING, 11);
|
386
|
+
output.writeString(this.lang);
|
387
|
+
output.writeFieldEnd();
|
388
|
+
}
|
389
|
+
if (this.corpus !== null && this.corpus !== undefined) {
|
390
|
+
output.writeFieldBegin('corpus', Thrift.Type.STRING, 12);
|
391
|
+
output.writeString(this.corpus);
|
392
|
+
output.writeFieldEnd();
|
393
|
+
}
|
394
|
+
if (this.k !== null && this.k !== undefined) {
|
395
|
+
output.writeFieldBegin('k', Thrift.Type.I32, 13);
|
396
|
+
output.writeI32(this.k);
|
397
|
+
output.writeFieldEnd();
|
398
|
+
}
|
399
|
+
if (this.communication !== null && this.communication !== undefined) {
|
400
|
+
output.writeFieldBegin('communication', Thrift.Type.STRUCT, 14);
|
401
|
+
this.communication.write(output);
|
402
|
+
output.writeFieldEnd();
|
403
|
+
}
|
404
|
+
output.writeFieldStop();
|
405
|
+
output.writeStructEnd();
|
406
|
+
return;
|
407
|
+
}
|
408
|
+
|
409
|
+
};
|
410
|
+
const SearchResultItem = module.exports.SearchResultItem = class {
|
411
|
+
constructor(args) {
|
412
|
+
this.communicationId = null;
|
413
|
+
this.sentenceId = null;
|
414
|
+
this.score = null;
|
415
|
+
this.tokens = null;
|
416
|
+
this.entity = null;
|
417
|
+
if (args) {
|
418
|
+
if (args.communicationId !== undefined && args.communicationId !== null) {
|
419
|
+
this.communicationId = args.communicationId;
|
420
|
+
}
|
421
|
+
if (args.sentenceId !== undefined && args.sentenceId !== null) {
|
422
|
+
this.sentenceId = new uuid_ttypes.UUID(args.sentenceId);
|
423
|
+
}
|
424
|
+
if (args.score !== undefined && args.score !== null) {
|
425
|
+
this.score = args.score;
|
426
|
+
}
|
427
|
+
if (args.tokens !== undefined && args.tokens !== null) {
|
428
|
+
this.tokens = new structure_ttypes.TokenRefSequence(args.tokens);
|
429
|
+
}
|
430
|
+
if (args.entity !== undefined && args.entity !== null) {
|
431
|
+
this.entity = new entities_ttypes.Entity(args.entity);
|
432
|
+
}
|
433
|
+
}
|
434
|
+
}
|
435
|
+
|
436
|
+
read (input) {
|
437
|
+
input.readStructBegin();
|
438
|
+
while (true) {
|
439
|
+
const ret = input.readFieldBegin();
|
440
|
+
const ftype = ret.ftype;
|
441
|
+
const fid = ret.fid;
|
442
|
+
if (ftype == Thrift.Type.STOP) {
|
443
|
+
break;
|
444
|
+
}
|
445
|
+
switch (fid) {
|
446
|
+
case 1:
|
447
|
+
if (ftype == Thrift.Type.STRING) {
|
448
|
+
this.communicationId = input.readString();
|
449
|
+
} else {
|
450
|
+
input.skip(ftype);
|
451
|
+
}
|
452
|
+
break;
|
453
|
+
case 2:
|
454
|
+
if (ftype == Thrift.Type.STRUCT) {
|
455
|
+
this.sentenceId = new uuid_ttypes.UUID();
|
456
|
+
this.sentenceId.read(input);
|
457
|
+
} else {
|
458
|
+
input.skip(ftype);
|
459
|
+
}
|
460
|
+
break;
|
461
|
+
case 3:
|
462
|
+
if (ftype == Thrift.Type.DOUBLE) {
|
463
|
+
this.score = input.readDouble();
|
464
|
+
} else {
|
465
|
+
input.skip(ftype);
|
466
|
+
}
|
467
|
+
break;
|
468
|
+
case 4:
|
469
|
+
if (ftype == Thrift.Type.STRUCT) {
|
470
|
+
this.tokens = new structure_ttypes.TokenRefSequence();
|
471
|
+
this.tokens.read(input);
|
472
|
+
} else {
|
473
|
+
input.skip(ftype);
|
474
|
+
}
|
475
|
+
break;
|
476
|
+
case 5:
|
477
|
+
if (ftype == Thrift.Type.STRUCT) {
|
478
|
+
this.entity = new entities_ttypes.Entity();
|
479
|
+
this.entity.read(input);
|
480
|
+
} else {
|
481
|
+
input.skip(ftype);
|
482
|
+
}
|
483
|
+
break;
|
484
|
+
default:
|
485
|
+
input.skip(ftype);
|
486
|
+
}
|
487
|
+
input.readFieldEnd();
|
488
|
+
}
|
489
|
+
input.readStructEnd();
|
490
|
+
return;
|
491
|
+
}
|
492
|
+
|
493
|
+
write (output) {
|
494
|
+
output.writeStructBegin('SearchResultItem');
|
495
|
+
if (this.communicationId !== null && this.communicationId !== undefined) {
|
496
|
+
output.writeFieldBegin('communicationId', Thrift.Type.STRING, 1);
|
497
|
+
output.writeString(this.communicationId);
|
498
|
+
output.writeFieldEnd();
|
499
|
+
}
|
500
|
+
if (this.sentenceId !== null && this.sentenceId !== undefined) {
|
501
|
+
output.writeFieldBegin('sentenceId', Thrift.Type.STRUCT, 2);
|
502
|
+
this.sentenceId.write(output);
|
503
|
+
output.writeFieldEnd();
|
504
|
+
}
|
505
|
+
if (this.score !== null && this.score !== undefined) {
|
506
|
+
output.writeFieldBegin('score', Thrift.Type.DOUBLE, 3);
|
507
|
+
output.writeDouble(this.score);
|
508
|
+
output.writeFieldEnd();
|
509
|
+
}
|
510
|
+
if (this.tokens !== null && this.tokens !== undefined) {
|
511
|
+
output.writeFieldBegin('tokens', Thrift.Type.STRUCT, 4);
|
512
|
+
this.tokens.write(output);
|
513
|
+
output.writeFieldEnd();
|
514
|
+
}
|
515
|
+
if (this.entity !== null && this.entity !== undefined) {
|
516
|
+
output.writeFieldBegin('entity', Thrift.Type.STRUCT, 5);
|
517
|
+
this.entity.write(output);
|
518
|
+
output.writeFieldEnd();
|
519
|
+
}
|
520
|
+
output.writeFieldStop();
|
521
|
+
output.writeStructEnd();
|
522
|
+
return;
|
523
|
+
}
|
524
|
+
|
525
|
+
};
|
526
|
+
const SearchResult = module.exports.SearchResult = class {
|
527
|
+
constructor(args) {
|
528
|
+
this.uuid = null;
|
529
|
+
this.searchQuery = null;
|
530
|
+
this.searchResultItems = null;
|
531
|
+
this.metadata = null;
|
532
|
+
this.lang = null;
|
533
|
+
if (args) {
|
534
|
+
if (args.uuid !== undefined && args.uuid !== null) {
|
535
|
+
this.uuid = new uuid_ttypes.UUID(args.uuid);
|
536
|
+
} else {
|
537
|
+
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field uuid is unset!');
|
538
|
+
}
|
539
|
+
if (args.searchQuery !== undefined && args.searchQuery !== null) {
|
540
|
+
this.searchQuery = new ttypes.SearchQuery(args.searchQuery);
|
541
|
+
} else {
|
542
|
+
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field searchQuery is unset!');
|
543
|
+
}
|
544
|
+
if (args.searchResultItems !== undefined && args.searchResultItems !== null) {
|
545
|
+
this.searchResultItems = Thrift.copyList(args.searchResultItems, [ttypes.SearchResultItem]);
|
546
|
+
}
|
547
|
+
if (args.metadata !== undefined && args.metadata !== null) {
|
548
|
+
this.metadata = new metadata_ttypes.AnnotationMetadata(args.metadata);
|
549
|
+
}
|
550
|
+
if (args.lang !== undefined && args.lang !== null) {
|
551
|
+
this.lang = args.lang;
|
552
|
+
}
|
553
|
+
}
|
554
|
+
}
|
555
|
+
|
556
|
+
read (input) {
|
557
|
+
input.readStructBegin();
|
558
|
+
while (true) {
|
559
|
+
const ret = input.readFieldBegin();
|
560
|
+
const ftype = ret.ftype;
|
561
|
+
const fid = ret.fid;
|
562
|
+
if (ftype == Thrift.Type.STOP) {
|
563
|
+
break;
|
564
|
+
}
|
565
|
+
switch (fid) {
|
566
|
+
case 1:
|
567
|
+
if (ftype == Thrift.Type.STRUCT) {
|
568
|
+
this.uuid = new uuid_ttypes.UUID();
|
569
|
+
this.uuid.read(input);
|
570
|
+
} else {
|
571
|
+
input.skip(ftype);
|
572
|
+
}
|
573
|
+
break;
|
574
|
+
case 2:
|
575
|
+
if (ftype == Thrift.Type.STRUCT) {
|
576
|
+
this.searchQuery = new ttypes.SearchQuery();
|
577
|
+
this.searchQuery.read(input);
|
578
|
+
} else {
|
579
|
+
input.skip(ftype);
|
580
|
+
}
|
581
|
+
break;
|
582
|
+
case 3:
|
583
|
+
if (ftype == Thrift.Type.LIST) {
|
584
|
+
this.searchResultItems = [];
|
585
|
+
const _rtmp316 = input.readListBegin();
|
586
|
+
const _size15 = _rtmp316.size || 0;
|
587
|
+
for (let _i17 = 0; _i17 < _size15; ++_i17) {
|
588
|
+
let elem18 = null;
|
589
|
+
elem18 = new ttypes.SearchResultItem();
|
590
|
+
elem18.read(input);
|
591
|
+
this.searchResultItems.push(elem18);
|
592
|
+
}
|
593
|
+
input.readListEnd();
|
594
|
+
} else {
|
595
|
+
input.skip(ftype);
|
596
|
+
}
|
597
|
+
break;
|
598
|
+
case 4:
|
599
|
+
if (ftype == Thrift.Type.STRUCT) {
|
600
|
+
this.metadata = new metadata_ttypes.AnnotationMetadata();
|
601
|
+
this.metadata.read(input);
|
602
|
+
} else {
|
603
|
+
input.skip(ftype);
|
604
|
+
}
|
605
|
+
break;
|
606
|
+
case 5:
|
607
|
+
if (ftype == Thrift.Type.STRING) {
|
608
|
+
this.lang = input.readString();
|
609
|
+
} else {
|
610
|
+
input.skip(ftype);
|
611
|
+
}
|
612
|
+
break;
|
613
|
+
default:
|
614
|
+
input.skip(ftype);
|
615
|
+
}
|
616
|
+
input.readFieldEnd();
|
617
|
+
}
|
618
|
+
input.readStructEnd();
|
619
|
+
return;
|
620
|
+
}
|
621
|
+
|
622
|
+
write (output) {
|
623
|
+
output.writeStructBegin('SearchResult');
|
624
|
+
if (this.uuid !== null && this.uuid !== undefined) {
|
625
|
+
output.writeFieldBegin('uuid', Thrift.Type.STRUCT, 1);
|
626
|
+
this.uuid.write(output);
|
627
|
+
output.writeFieldEnd();
|
628
|
+
}
|
629
|
+
if (this.searchQuery !== null && this.searchQuery !== undefined) {
|
630
|
+
output.writeFieldBegin('searchQuery', Thrift.Type.STRUCT, 2);
|
631
|
+
this.searchQuery.write(output);
|
632
|
+
output.writeFieldEnd();
|
633
|
+
}
|
634
|
+
if (this.searchResultItems !== null && this.searchResultItems !== undefined) {
|
635
|
+
output.writeFieldBegin('searchResultItems', Thrift.Type.LIST, 3);
|
636
|
+
output.writeListBegin(Thrift.Type.STRUCT, this.searchResultItems.length);
|
637
|
+
for (let iter19 in this.searchResultItems) {
|
638
|
+
if (this.searchResultItems.hasOwnProperty(iter19)) {
|
639
|
+
iter19 = this.searchResultItems[iter19];
|
640
|
+
iter19.write(output);
|
641
|
+
}
|
642
|
+
}
|
643
|
+
output.writeListEnd();
|
644
|
+
output.writeFieldEnd();
|
645
|
+
}
|
646
|
+
if (this.metadata !== null && this.metadata !== undefined) {
|
647
|
+
output.writeFieldBegin('metadata', Thrift.Type.STRUCT, 4);
|
648
|
+
this.metadata.write(output);
|
649
|
+
output.writeFieldEnd();
|
650
|
+
}
|
651
|
+
if (this.lang !== null && this.lang !== undefined) {
|
652
|
+
output.writeFieldBegin('lang', Thrift.Type.STRING, 5);
|
653
|
+
output.writeString(this.lang);
|
654
|
+
output.writeFieldEnd();
|
655
|
+
}
|
656
|
+
output.writeFieldStop();
|
657
|
+
output.writeStructEnd();
|
658
|
+
return;
|
659
|
+
}
|
660
|
+
|
661
|
+
};
|