@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/util.js
CHANGED
@@ -1,118 +1,118 @@
|
|
1
|
-
/**
|
2
|
-
* @namespace concrete
|
3
|
-
*/
|
4
|
-
const concrete = module.exports = {};
|
5
|
-
concrete.uuid = require('./uuid_types');
|
6
|
-
const UUID = concrete.uuid.UUID;
|
7
|
-
|
8
|
-
/**
|
9
|
-
* @namespace concrete.util
|
10
|
-
*/
|
11
|
-
const util = concrete.util = {};
|
12
|
-
|
13
|
-
/**
|
14
|
-
* Generate a Concrete UUID
|
15
|
-
*
|
16
|
-
* @returns {UUID}
|
17
|
-
*
|
18
|
-
* @function concrete.util.generateUUID
|
19
|
-
* @memberof concrete.util
|
20
|
-
*/
|
21
|
-
util.generateUUID = function() {
|
22
|
-
var uuid = new UUID();
|
23
|
-
uuid.uuidString = util.generateUUIDString();
|
24
|
-
return uuid;
|
25
|
-
};
|
26
|
-
|
27
|
-
/**
|
28
|
-
* Generate a UUID string
|
29
|
-
* Code based on the uuid.core.js script from MIT licensed project 'UUID.js':
|
30
|
-
* https://github.com/LiosK/UUID.js
|
31
|
-
*
|
32
|
-
* @returns {String}
|
33
|
-
*
|
34
|
-
* @function concrete.util.generateUUIDString
|
35
|
-
* @memberof concrete.util
|
36
|
-
*/
|
37
|
-
util.generateUUIDString = function() {
|
38
|
-
/**
|
39
|
-
* Returns an unsigned x-bit random integer.
|
40
|
-
* @param {int} x A positive integer ranging from 0 to 53, inclusive.
|
41
|
-
* @returns {int} An unsigned x-bit random integer (0 <= f(x) < 2^x).
|
42
|
-
*/
|
43
|
-
function rand(x) { // _getRandomInt
|
44
|
-
if (x < 0) return NaN;
|
45
|
-
if (x <= 30) return (0 | Math.random() * (1 << x));
|
46
|
-
if (x <= 53) return (0 | Math.random() * (1 << 30)) +
|
47
|
-
(0 | Math.random() * (1 << x - 30)) * (1 << 30);
|
48
|
-
return NaN;
|
49
|
-
}
|
50
|
-
|
51
|
-
/**
|
52
|
-
* Converts an integer to a zero-filled hexadecimal string.
|
53
|
-
* @param {int} num
|
54
|
-
* @param {int} length
|
55
|
-
* @returns {string}
|
56
|
-
*/
|
57
|
-
function hex(num, length) { // _hexAligner
|
58
|
-
var str = num.toString(16), i = length - str.length, z = "0";
|
59
|
-
for (; i > 0; i >>>= 1, z += z) { if (i & 1) { str = z + str; } }
|
60
|
-
return str;
|
61
|
-
}
|
62
|
-
|
63
|
-
return hex(rand(32), 8) + // time_low
|
64
|
-
"-" +
|
65
|
-
hex(rand(16), 4) + // time_mid
|
66
|
-
"-" +
|
67
|
-
hex(0x4000 | rand(12), 4) + // time_hi_and_version
|
68
|
-
"-" +
|
69
|
-
hex(0x8000 | rand(14), 4) + // clock_seq_hi_and_reserved clock_seq_low
|
70
|
-
"-" +
|
71
|
-
hex(rand(48), 12); // node
|
72
|
-
};
|
73
|
-
|
74
|
-
/** Retrieve HTTP GET parameters by name
|
75
|
-
*
|
76
|
-
* Adapted from:
|
77
|
-
* http://stackoverflow.com/questions/19491336/get-url-parameter-jquery-or-how-to-get-query-string-values-in-js
|
78
|
-
*
|
79
|
-
* @param {String} sParam - Name of HTTP GET parameter to retrieve
|
80
|
-
* @returns {String}
|
81
|
-
*
|
82
|
-
* @function concrete.util.getURLParameter
|
83
|
-
* @memberof concrete.util
|
84
|
-
*/
|
85
|
-
util.getURLParameter = function(sParam) {
|
86
|
-
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
|
87
|
-
sURLVariables = sPageURL.split('&'),
|
88
|
-
sParameterName,
|
89
|
-
i;
|
90
|
-
|
91
|
-
for (i = 0; i < sURLVariables.length; i++) {
|
92
|
-
sParameterName = sURLVariables[i].split('=');
|
93
|
-
|
94
|
-
if (sParameterName[0] === sParam) {
|
95
|
-
return sParameterName[1] === undefined ? true : sParameterName[1];
|
96
|
-
}
|
97
|
-
}
|
98
|
-
};
|
99
|
-
|
100
|
-
|
101
|
-
/**
|
102
|
-
* Takes a string, returns a version of the string that replaces
|
103
|
-
* any of the CSS selector metacharacters:
|
104
|
-
* !"#$%&'()*+,./:;<=>?@[\]^`{|}~
|
105
|
-
* with an underscore. Per the jQuery documentation, these
|
106
|
-
* metacharacters in CSS selector names if they are escaped with '\\',
|
107
|
-
* but replacing them with underscores seems less likely to cause
|
108
|
-
* strange behavior.
|
109
|
-
*
|
110
|
-
* Useful for handling Entity IDs that are prefixed with a colon,
|
111
|
-
* e.g. ':Entity_ENG_EDL_0088070'.
|
112
|
-
*
|
113
|
-
* @param {String} s
|
114
|
-
* @returns {String}
|
115
|
-
*/
|
116
|
-
util.selectorSafeString = function(s) {
|
117
|
-
return s.replace(/[!"#$%&'()*+,./:;<=>?@[\]^`{|}~]/g, '_');
|
1
|
+
/**
|
2
|
+
* @namespace concrete
|
3
|
+
*/
|
4
|
+
const concrete = module.exports = {};
|
5
|
+
concrete.uuid = require('./uuid_types');
|
6
|
+
const UUID = concrete.uuid.UUID;
|
7
|
+
|
8
|
+
/**
|
9
|
+
* @namespace concrete.util
|
10
|
+
*/
|
11
|
+
const util = concrete.util = {};
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Generate a Concrete UUID
|
15
|
+
*
|
16
|
+
* @returns {UUID}
|
17
|
+
*
|
18
|
+
* @function concrete.util.generateUUID
|
19
|
+
* @memberof concrete.util
|
20
|
+
*/
|
21
|
+
util.generateUUID = function() {
|
22
|
+
var uuid = new UUID();
|
23
|
+
uuid.uuidString = util.generateUUIDString();
|
24
|
+
return uuid;
|
25
|
+
};
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Generate a UUID string
|
29
|
+
* Code based on the uuid.core.js script from MIT licensed project 'UUID.js':
|
30
|
+
* https://github.com/LiosK/UUID.js
|
31
|
+
*
|
32
|
+
* @returns {String}
|
33
|
+
*
|
34
|
+
* @function concrete.util.generateUUIDString
|
35
|
+
* @memberof concrete.util
|
36
|
+
*/
|
37
|
+
util.generateUUIDString = function() {
|
38
|
+
/**
|
39
|
+
* Returns an unsigned x-bit random integer.
|
40
|
+
* @param {int} x A positive integer ranging from 0 to 53, inclusive.
|
41
|
+
* @returns {int} An unsigned x-bit random integer (0 <= f(x) < 2^x).
|
42
|
+
*/
|
43
|
+
function rand(x) { // _getRandomInt
|
44
|
+
if (x < 0) return NaN;
|
45
|
+
if (x <= 30) return (0 | Math.random() * (1 << x));
|
46
|
+
if (x <= 53) return (0 | Math.random() * (1 << 30)) +
|
47
|
+
(0 | Math.random() * (1 << x - 30)) * (1 << 30);
|
48
|
+
return NaN;
|
49
|
+
}
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Converts an integer to a zero-filled hexadecimal string.
|
53
|
+
* @param {int} num
|
54
|
+
* @param {int} length
|
55
|
+
* @returns {string}
|
56
|
+
*/
|
57
|
+
function hex(num, length) { // _hexAligner
|
58
|
+
var str = num.toString(16), i = length - str.length, z = "0";
|
59
|
+
for (; i > 0; i >>>= 1, z += z) { if (i & 1) { str = z + str; } }
|
60
|
+
return str;
|
61
|
+
}
|
62
|
+
|
63
|
+
return hex(rand(32), 8) + // time_low
|
64
|
+
"-" +
|
65
|
+
hex(rand(16), 4) + // time_mid
|
66
|
+
"-" +
|
67
|
+
hex(0x4000 | rand(12), 4) + // time_hi_and_version
|
68
|
+
"-" +
|
69
|
+
hex(0x8000 | rand(14), 4) + // clock_seq_hi_and_reserved clock_seq_low
|
70
|
+
"-" +
|
71
|
+
hex(rand(48), 12); // node
|
72
|
+
};
|
73
|
+
|
74
|
+
/** Retrieve HTTP GET parameters by name
|
75
|
+
*
|
76
|
+
* Adapted from:
|
77
|
+
* http://stackoverflow.com/questions/19491336/get-url-parameter-jquery-or-how-to-get-query-string-values-in-js
|
78
|
+
*
|
79
|
+
* @param {String} sParam - Name of HTTP GET parameter to retrieve
|
80
|
+
* @returns {String}
|
81
|
+
*
|
82
|
+
* @function concrete.util.getURLParameter
|
83
|
+
* @memberof concrete.util
|
84
|
+
*/
|
85
|
+
util.getURLParameter = function(sParam) {
|
86
|
+
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
|
87
|
+
sURLVariables = sPageURL.split('&'),
|
88
|
+
sParameterName,
|
89
|
+
i;
|
90
|
+
|
91
|
+
for (i = 0; i < sURLVariables.length; i++) {
|
92
|
+
sParameterName = sURLVariables[i].split('=');
|
93
|
+
|
94
|
+
if (sParameterName[0] === sParam) {
|
95
|
+
return sParameterName[1] === undefined ? true : sParameterName[1];
|
96
|
+
}
|
97
|
+
}
|
98
|
+
};
|
99
|
+
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Takes a string, returns a version of the string that replaces
|
103
|
+
* any of the CSS selector metacharacters:
|
104
|
+
* !"#$%&'()*+,./:;<=>?@[\]^`{|}~
|
105
|
+
* with an underscore. Per the jQuery documentation, these
|
106
|
+
* metacharacters in CSS selector names if they are escaped with '\\',
|
107
|
+
* but replacing them with underscores seems less likely to cause
|
108
|
+
* strange behavior.
|
109
|
+
*
|
110
|
+
* Useful for handling Entity IDs that are prefixed with a colon,
|
111
|
+
* e.g. ':Entity_ENG_EDL_0088070'.
|
112
|
+
*
|
113
|
+
* @param {String} s
|
114
|
+
* @returns {String}
|
115
|
+
*/
|
116
|
+
util.selectorSafeString = function(s) {
|
117
|
+
return s.replace(/[!"#$%&'()*+,./:;<=>?@[\]^`{|}~]/g, '_');
|
118
118
|
};
|
package/uuid_types.js
CHANGED
@@ -1,67 +1,67 @@
|
|
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
|
-
|
13
|
-
const ttypes = module.exports = {};
|
14
|
-
const UUID = module.exports.UUID = class {
|
15
|
-
constructor(args) {
|
16
|
-
this.uuidString = null;
|
17
|
-
if (args) {
|
18
|
-
if (args.uuidString !== undefined && args.uuidString !== null) {
|
19
|
-
this.uuidString = args.uuidString;
|
20
|
-
} else {
|
21
|
-
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field uuidString is unset!');
|
22
|
-
}
|
23
|
-
}
|
24
|
-
}
|
25
|
-
|
26
|
-
read (input) {
|
27
|
-
input.readStructBegin();
|
28
|
-
while (true) {
|
29
|
-
const ret = input.readFieldBegin();
|
30
|
-
const ftype = ret.ftype;
|
31
|
-
const fid = ret.fid;
|
32
|
-
if (ftype == Thrift.Type.STOP) {
|
33
|
-
break;
|
34
|
-
}
|
35
|
-
switch (fid) {
|
36
|
-
case 1:
|
37
|
-
if (ftype == Thrift.Type.STRING) {
|
38
|
-
this.uuidString = input.readString();
|
39
|
-
} else {
|
40
|
-
input.skip(ftype);
|
41
|
-
}
|
42
|
-
break;
|
43
|
-
case 0:
|
44
|
-
input.skip(ftype);
|
45
|
-
break;
|
46
|
-
default:
|
47
|
-
input.skip(ftype);
|
48
|
-
}
|
49
|
-
input.readFieldEnd();
|
50
|
-
}
|
51
|
-
input.readStructEnd();
|
52
|
-
return;
|
53
|
-
}
|
54
|
-
|
55
|
-
write (output) {
|
56
|
-
output.writeStructBegin('UUID');
|
57
|
-
if (this.uuidString !== null && this.uuidString !== undefined) {
|
58
|
-
output.writeFieldBegin('uuidString', Thrift.Type.STRING, 1);
|
59
|
-
output.writeString(this.uuidString);
|
60
|
-
output.writeFieldEnd();
|
61
|
-
}
|
62
|
-
output.writeFieldStop();
|
63
|
-
output.writeStructEnd();
|
64
|
-
return;
|
65
|
-
}
|
66
|
-
|
67
|
-
};
|
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
|
+
|
13
|
+
const ttypes = module.exports = {};
|
14
|
+
const UUID = module.exports.UUID = class {
|
15
|
+
constructor(args) {
|
16
|
+
this.uuidString = null;
|
17
|
+
if (args) {
|
18
|
+
if (args.uuidString !== undefined && args.uuidString !== null) {
|
19
|
+
this.uuidString = args.uuidString;
|
20
|
+
} else {
|
21
|
+
throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field uuidString is unset!');
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
read (input) {
|
27
|
+
input.readStructBegin();
|
28
|
+
while (true) {
|
29
|
+
const ret = input.readFieldBegin();
|
30
|
+
const ftype = ret.ftype;
|
31
|
+
const fid = ret.fid;
|
32
|
+
if (ftype == Thrift.Type.STOP) {
|
33
|
+
break;
|
34
|
+
}
|
35
|
+
switch (fid) {
|
36
|
+
case 1:
|
37
|
+
if (ftype == Thrift.Type.STRING) {
|
38
|
+
this.uuidString = input.readString();
|
39
|
+
} else {
|
40
|
+
input.skip(ftype);
|
41
|
+
}
|
42
|
+
break;
|
43
|
+
case 0:
|
44
|
+
input.skip(ftype);
|
45
|
+
break;
|
46
|
+
default:
|
47
|
+
input.skip(ftype);
|
48
|
+
}
|
49
|
+
input.readFieldEnd();
|
50
|
+
}
|
51
|
+
input.readStructEnd();
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
|
55
|
+
write (output) {
|
56
|
+
output.writeStructBegin('UUID');
|
57
|
+
if (this.uuidString !== null && this.uuidString !== undefined) {
|
58
|
+
output.writeFieldBegin('uuidString', Thrift.Type.STRING, 1);
|
59
|
+
output.writeString(this.uuidString);
|
60
|
+
output.writeFieldEnd();
|
61
|
+
}
|
62
|
+
output.writeFieldStop();
|
63
|
+
output.writeStructEnd();
|
64
|
+
return;
|
65
|
+
}
|
66
|
+
|
67
|
+
};
|