eventregistry 8.11.1 → 9.1.0
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/dist/analytics.d.ts +82 -82
- package/dist/analytics.js +336 -330
- package/dist/analytics.js.map +1 -1
- package/dist/base.d.ts +82 -81
- package/dist/base.js +261 -219
- package/dist/base.js.map +1 -1
- package/dist/counts.d.ts +81 -81
- package/dist/counts.js +162 -149
- package/dist/counts.js.map +1 -1
- package/dist/dailyShares.d.ts +10 -10
- package/dist/dailyShares.js +90 -77
- package/dist/dailyShares.js.map +1 -1
- package/dist/data.d.ts +269 -268
- package/dist/data.js +3 -3
- package/dist/eventForText.d.ts +48 -48
- package/dist/eventForText.js +126 -123
- package/dist/eventForText.js.map +1 -1
- package/dist/eventRegistry.d.ts +244 -224
- package/dist/eventRegistry.js +1098 -1018
- package/dist/eventRegistry.js.map +1 -1
- package/dist/index.d.ts +21 -20
- package/dist/index.js +128 -122
- package/dist/index.js.map +1 -1
- package/dist/info.d.ts +61 -61
- package/dist/info.js +171 -158
- package/dist/info.js.map +1 -1
- package/dist/logger.d.ts +44 -0
- package/dist/logger.js +144 -0
- package/dist/logger.js.map +1 -0
- package/dist/query.d.ts +53 -53
- package/dist/query.js +333 -290
- package/dist/query.js.map +1 -1
- package/dist/queryArticle.d.ts +61 -61
- package/dist/queryArticle.js +183 -168
- package/dist/queryArticle.js.map +1 -1
- package/dist/queryArticles.d.ts +144 -160
- package/dist/queryArticles.js +729 -701
- package/dist/queryArticles.js.map +1 -1
- package/dist/queryEvent.d.ts +140 -140
- package/dist/queryEvent.js +587 -569
- package/dist/queryEvent.js.map +1 -1
- package/dist/queryEvents.d.ts +210 -210
- package/dist/queryEvents.js +825 -798
- package/dist/queryEvents.js.map +1 -1
- package/dist/queryMentions.d.ts +96 -96
- package/dist/queryMentions.js +637 -600
- package/dist/queryMentions.js.map +1 -1
- package/dist/queryStory.d.ts +58 -58
- package/dist/queryStory.js +194 -174
- package/dist/queryStory.js.map +1 -1
- package/dist/recent.d.ts +23 -23
- package/dist/recent.js +199 -179
- package/dist/recent.js.map +1 -1
- package/dist/returnInfo.d.ts +68 -66
- package/dist/returnInfo.js +332 -304
- package/dist/returnInfo.js.map +1 -1
- package/dist/topicPage.d.ts +157 -157
- package/dist/topicPage.js +599 -604
- package/dist/topicPage.js.map +1 -1
- package/dist/trends.d.ts +35 -35
- package/dist/trends.js +115 -102
- package/dist/trends.js.map +1 -1
- package/dist/types.d.ts +2453 -2155
- package/dist/types.js +2 -2
- package/package.json +13 -13
package/dist/eventForText.js
CHANGED
|
@@ -1,124 +1,127 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
}
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
d
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
case
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (t
|
|
42
|
-
if (t[
|
|
43
|
-
_.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* "
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
case
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.GetEventForText = void 0;
|
|
55
|
+
var base_1 = require("./base");
|
|
56
|
+
/**
|
|
57
|
+
* The GetEventForText class can be used to find the event(s) that best matches the given input text.
|
|
58
|
+
* The request is performed asynchronously.
|
|
59
|
+
*
|
|
60
|
+
* Note: The functionality can only be used to find the events in the last 5 days. Older events cannot
|
|
61
|
+
* be matched in this way
|
|
62
|
+
*
|
|
63
|
+
* Return info from the compute() method is in the form:
|
|
64
|
+
*
|
|
65
|
+
* [
|
|
66
|
+
* {
|
|
67
|
+
* "cosSim": 0.07660648086468567,
|
|
68
|
+
* "eventUri": "4969",
|
|
69
|
+
* "storyUri": "eng-af6ce79f-cb91-4010-8ddf-7ad924bc5638-40591"
|
|
70
|
+
* },
|
|
71
|
+
* {
|
|
72
|
+
* "cosSim": 0.05851939237670918,
|
|
73
|
+
* "eventUri": "5157",
|
|
74
|
+
* "storyUri": "eng-af6ce79f-cb91-4010-8ddf-7ad924bc5638-56286"
|
|
75
|
+
* },
|
|
76
|
+
* ...
|
|
77
|
+
* ]
|
|
78
|
+
*
|
|
79
|
+
* Where
|
|
80
|
+
* - cosSim represents the cosine similarity of the document to the cluster
|
|
81
|
+
* - eventUri is the uri of the corresponding event in the Event Registry
|
|
82
|
+
* - storyUri is the uri of the story in the Event Registry
|
|
83
|
+
*
|
|
84
|
+
* You can use QueryEvent or QueryStory to obtain more information about these events/stories
|
|
85
|
+
*
|
|
86
|
+
*/
|
|
87
|
+
var GetEventForText = /** @class */ (function (_super) {
|
|
88
|
+
__extends(GetEventForText, _super);
|
|
89
|
+
/**
|
|
90
|
+
* @param er instance of EventRegistry class
|
|
91
|
+
* @param nrOfEventsToReturn number of events to return for the given text
|
|
92
|
+
*/
|
|
93
|
+
function GetEventForText(er, nrOfEventsToReturn) {
|
|
94
|
+
if (nrOfEventsToReturn === void 0) { nrOfEventsToReturn = 5; }
|
|
95
|
+
var _this = _super.call(this) || this;
|
|
96
|
+
_this.er = er;
|
|
97
|
+
_this.nrOfEventsToReturn = nrOfEventsToReturn;
|
|
98
|
+
return _this;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Compute the list of most similar events for the given text
|
|
102
|
+
* @param text text for which to find the most similar event
|
|
103
|
+
* @param lang language in which the text is written
|
|
104
|
+
*/
|
|
105
|
+
GetEventForText.prototype.compute = function (text_1) {
|
|
106
|
+
return __awaiter(this, arguments, void 0, function (text, lang) {
|
|
107
|
+
var params, response;
|
|
108
|
+
if (lang === void 0) { lang = "eng"; }
|
|
109
|
+
return __generator(this, function (_a) {
|
|
110
|
+
switch (_a.label) {
|
|
111
|
+
case 0:
|
|
112
|
+
params = { lang: lang, text: text, topClustersCount: this.nrOfEventsToReturn };
|
|
113
|
+
return [4 /*yield*/, this.er.jsonRequest("/api/v1/getEventForText/getEventForText", params)];
|
|
114
|
+
case 1:
|
|
115
|
+
response = _a.sent();
|
|
116
|
+
if ((response === null || response === void 0 ? void 0 : response.data.topStories) !== undefined) {
|
|
117
|
+
return [2 /*return*/, response.data.topStories];
|
|
118
|
+
}
|
|
119
|
+
return [2 /*return*/, response];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
return GetEventForText;
|
|
125
|
+
}(base_1.QueryParamsBase));
|
|
126
|
+
exports.GetEventForText = GetEventForText;
|
|
124
127
|
//# sourceMappingURL=eventForText.js.map
|
package/dist/eventForText.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventForText.js","sourceRoot":"","sources":["../src/eventForText.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"eventForText.js","sourceRoot":"","sources":["../src/eventForText.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAyC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH;IAAqC,mCAAe;IAGhD;;;OAGG;IACH,yBAAY,EAAiB,EAAE,kBAA8B;QAA9B,mCAAA,EAAA,sBAA8B;QACzD,YAAA,MAAK,WAAE,SAAC;QACR,KAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,KAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;;IACjD,CAAC;IAED;;;;OAIG;IACU,iCAAO,GAApB;4DAAqB,IAAY,EAAE,IAAoB;;YAApB,qBAAA,EAAA,YAAoB;;;;wBAC7C,MAAM,GAAG,EAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,CAAC,kBAAkB,EAAC,CAAC;wBAClE,qBAAM,IAAI,CAAC,EAAE,CAAC,WAAW,CAAyB,yCAAyC,EAAE,MAAM,CAAC,EAAA;;wBAA/G,QAAQ,GAAG,SAAoG;wBACrH,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,CAAC,UAAU,MAAK,SAAS,EAAE,CAAC;4BAC1C,sBAAO,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAC;wBACpC,CAAC;wBACD,sBAAO,QAAQ,EAAC;;;;KACnB;IACL,sBAAC;AAAD,CAAC,AA1BD,CAAqC,sBAAe,GA0BnD;AA1BY,0CAAe"}
|