eventregistry 8.9.2 → 8.10.2
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/CHANGELOG.md +17 -1
- package/dist/eventRegistry.js +2 -2
- package/dist/eventRegistry.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/queryArticles.js +6 -0
- package/dist/queryArticles.js.map +1 -1
- package/dist/queryEvents.js +6 -0
- package/dist/queryEvents.js.map +1 -1
- package/dist/queryMentions.d.ts +95 -0
- package/dist/queryMentions.js +579 -0
- package/dist/queryMentions.js.map +1 -0
- package/dist/topicPage.js +2 -2
- package/dist/topicPage.js.map +1 -1
- package/{src → dist}/types.d.ts +284 -195
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +6 -5
- package/dist/correlations.d.ts +0 -50
- package/dist/correlations.js +0 -397
- package/dist/correlations.js.map +0 -1
- package/examples/autoSuggestionsExamples.ts +0 -46
- package/examples/countsExamples.ts +0 -34
- package/examples/dailySharesExamples.ts +0 -54
- package/examples/eventForTextExamples.ts +0 -32
- package/examples/feedOfNewArticlesExamples.ts +0 -82
- package/examples/feedOfNewEventsExamples.ts +0 -70
- package/examples/queryArticleExamples.ts +0 -42
- package/examples/queryArticlesExamples.ts +0 -242
- package/examples/queryEventExamples.ts +0 -99
- package/examples/queryEventsExamples.ts +0 -232
- package/examples/topicPageExamples.ts +0 -97
- package/examples/trendsExamples.ts +0 -34
- package/src/analytics.ts +0 -181
- package/src/base.ts +0 -198
- package/src/counts.ts +0 -119
- package/src/dailyShares.ts +0 -48
- package/src/eventForText.ts +0 -61
- package/src/eventRegistry.ts +0 -733
- package/src/index.ts +0 -111
- package/src/info.ts +0 -121
- package/src/query.ts +0 -257
- package/src/queryArticle.ts +0 -139
- package/src/queryArticles.ts +0 -603
- package/src/queryEvent.ts +0 -473
- package/src/queryEvents.ts +0 -684
- package/src/queryStory.ts +0 -152
- package/src/recent.ts +0 -63
- package/src/returnInfo.ts +0 -363
- package/src/topicPage.ts +0 -479
- package/src/trends.ts +0 -63
- package/test/index.d.ts +0 -18
- package/test/jasmine.json +0 -10
- package/test/spec/analytics.spec.ts +0 -150
- package/test/spec/autoSuggestions.spec.ts +0 -54
- package/test/spec/info.spec.ts +0 -84
- package/test/spec/invalidQueries.spec.ts +0 -147
- package/test/spec/queryArticle.spec.ts +0 -62
- package/test/spec/queryArticles.spec.ts +0 -541
- package/test/spec/queryArticlesComplex.spec.ts +0 -298
- package/test/spec/queryEvent.spec.ts +0 -194
- package/test/spec/queryEvents.spec.ts +0 -491
- package/test/spec/queryEventsComplex.spec.ts +0 -188
- package/test/spec/queryPaging.spec.ts +0 -318
- package/test/spec/returnInfo.spec.ts +0 -34
- package/test/spec/topicPage.spec.ts +0 -83
- package/test/spec/utils.ts +0 -436
- package/test/tsconfig.json +0 -31
- package/tsconfig.json +0 -32
- package/tslint.json +0 -25
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "Anže Sršen",
|
|
3
3
|
"name": "eventregistry",
|
|
4
4
|
"description": "Package containing wrapper functions for Event Registry API",
|
|
5
|
-
"version": "8.
|
|
5
|
+
"version": "8.10.2",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/EventRegistry/event-registry-node-js.git"
|
|
12
12
|
},
|
|
13
|
+
"files": ["dist"],
|
|
13
14
|
"scripts": {
|
|
14
15
|
"build": "tsc --project tsconfig.json",
|
|
15
16
|
"build:watch": "tsc --watch --project tsconfig.json",
|
|
@@ -21,15 +22,15 @@
|
|
|
21
22
|
"node": ">=5.0.0"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
25
|
+
"@types/jasmine": "2.8.6",
|
|
26
|
+
"@types/lodash": "4.14.108",
|
|
27
|
+
"@types/node": "8.0.50",
|
|
28
|
+
"@types/qs": "6.5.1",
|
|
24
29
|
"jasmine": "2.8.0",
|
|
25
30
|
"tslint": "^6.0.0",
|
|
26
31
|
"typescript": "3.0.1"
|
|
27
32
|
},
|
|
28
33
|
"dependencies": {
|
|
29
|
-
"@types/jasmine": "2.8.6",
|
|
30
|
-
"@types/lodash": "4.14.108",
|
|
31
|
-
"@types/node": "8.0.50",
|
|
32
|
-
"@types/qs": "6.5.1",
|
|
33
34
|
"axios": "^0.21.1",
|
|
34
35
|
"lodash": "^4.17.21",
|
|
35
36
|
"moment": "^2.29.1",
|
package/dist/correlations.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { QueryParamsBase } from "./base";
|
|
2
|
-
import { GetCounts } from "./counts";
|
|
3
|
-
import { EventRegistry } from "./eventRegistry";
|
|
4
|
-
import { QueryArticles } from "./queryArticles";
|
|
5
|
-
import { EventRegistryStatic } from "./types";
|
|
6
|
-
/**
|
|
7
|
-
* @class GetTopCorrelations
|
|
8
|
-
* Provides classes needed to identify concepts or categories
|
|
9
|
-
* that trend the most with a concept, category or a custom time series
|
|
10
|
-
*/
|
|
11
|
-
export declare class GetTopCorrelations extends QueryParamsBase {
|
|
12
|
-
private er;
|
|
13
|
-
constructor(er: EventRegistry);
|
|
14
|
-
readonly path: string;
|
|
15
|
-
/**
|
|
16
|
-
* Specify the user defined array of input data
|
|
17
|
-
* @param inputDataArr: array of tuples (date, val) where date is a date object or string in YYYY-MM-DD format and val is the value/counts for that date
|
|
18
|
-
*/
|
|
19
|
-
setCustomInputData(inputDataArr: any): void;
|
|
20
|
-
/**
|
|
21
|
-
* Use the queryArticles to find articles that match the criteria. For the articles that match
|
|
22
|
-
* criteria in queryArticles compute the time-series (number of resulting articles for each date)
|
|
23
|
-
* an use the time series as the input data.
|
|
24
|
-
* @param queryArticles An instance of QueryArticles class, containing the conditions that are use to find the matching time-series. You don't need to specify any requested result.
|
|
25
|
-
*/
|
|
26
|
-
loadInputDataWithQuery(queryArticles: QueryArticles): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Use GetCounts class to obtain daily counts information for concept/category of interest.
|
|
29
|
-
* @param getCounts An instance of GetCounts class.
|
|
30
|
-
*/
|
|
31
|
-
loadInputDataWithCounts(getCounts: GetCounts): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Do we have valid input data (needed before we can compute correlations)
|
|
34
|
-
*/
|
|
35
|
-
hasValidInputData(): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Compute concepts that correlate the most with the input data. If candidateConceptsQuery is provided we first identify the
|
|
38
|
-
* concepts that are potentially returned as top correlations. Candidates are obtained by making the query and analyzing the
|
|
39
|
-
* concepts that appear in the resulting articles. The top concepts are used as candidates among which we return the top correlations.
|
|
40
|
-
* If conceptType is provided then only concepts of the specified type can be provided as the result.
|
|
41
|
-
*
|
|
42
|
-
* @param args Object which contains a host of optional parameters
|
|
43
|
-
*/
|
|
44
|
-
getTopConceptCorrelations(args?: EventRegistryStatic.Correlations.TopConceptArguments): Promise<any>;
|
|
45
|
-
/**
|
|
46
|
-
* Compute categories that correlate the most with the input data.
|
|
47
|
-
* @param args Object which contains a host of optional parameters
|
|
48
|
-
*/
|
|
49
|
-
getTopCategoryCorrelations(args?: EventRegistryStatic.Correlations.TopCategoryArguments): Promise<any>;
|
|
50
|
-
}
|
package/dist/correlations.js
DELETED
|
@@ -1,397 +0,0 @@
|
|
|
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 (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
}
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
24
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
25
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
26
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
27
|
-
function step(op) {
|
|
28
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
29
|
-
while (_) try {
|
|
30
|
-
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;
|
|
31
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
32
|
-
switch (op[0]) {
|
|
33
|
-
case 0: case 1: t = op; break;
|
|
34
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
35
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
36
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
37
|
-
default:
|
|
38
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
39
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
40
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
41
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
42
|
-
if (t[2]) _.ops.pop();
|
|
43
|
-
_.trys.pop(); continue;
|
|
44
|
-
}
|
|
45
|
-
op = body.call(thisArg, _);
|
|
46
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
47
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
var __values = (this && this.__values) || function (o) {
|
|
51
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
|
|
52
|
-
if (m) return m.call(o);
|
|
53
|
-
return {
|
|
54
|
-
next: function () {
|
|
55
|
-
if (o && i >= o.length) o = void 0;
|
|
56
|
-
return { value: o && o[i++], done: !o };
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
61
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
62
|
-
if (!m) return o;
|
|
63
|
-
var i = m.call(o), r, ar = [], e;
|
|
64
|
-
try {
|
|
65
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
66
|
-
}
|
|
67
|
-
catch (error) { e = { error: error }; }
|
|
68
|
-
finally {
|
|
69
|
-
try {
|
|
70
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
71
|
-
}
|
|
72
|
-
finally { if (e) throw e.error; }
|
|
73
|
-
}
|
|
74
|
-
return ar;
|
|
75
|
-
};
|
|
76
|
-
var __spread = (this && this.__spread) || function () {
|
|
77
|
-
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
78
|
-
return ar;
|
|
79
|
-
};
|
|
80
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
81
|
-
var _ = require("lodash");
|
|
82
|
-
var base_1 = require("./base");
|
|
83
|
-
var counts_1 = require("./counts");
|
|
84
|
-
var info_1 = require("./info");
|
|
85
|
-
var queryArticles_1 = require("./queryArticles");
|
|
86
|
-
var returnInfo_1 = require("./returnInfo");
|
|
87
|
-
/**
|
|
88
|
-
* @class GetTopCorrelations
|
|
89
|
-
* Provides classes needed to identify concepts or categories
|
|
90
|
-
* that trend the most with a concept, category or a custom time series
|
|
91
|
-
*/
|
|
92
|
-
var GetTopCorrelations = /** @class */ (function (_super) {
|
|
93
|
-
__extends(GetTopCorrelations, _super);
|
|
94
|
-
function GetTopCorrelations(er) {
|
|
95
|
-
var _this = _super.call(this) || this;
|
|
96
|
-
_this.er = er;
|
|
97
|
-
_this.setVal("action", "findTopCorrelations");
|
|
98
|
-
return _this;
|
|
99
|
-
}
|
|
100
|
-
Object.defineProperty(GetTopCorrelations.prototype, "path", {
|
|
101
|
-
get: function () {
|
|
102
|
-
return "/json/correlate";
|
|
103
|
-
},
|
|
104
|
-
enumerable: true,
|
|
105
|
-
configurable: true
|
|
106
|
-
});
|
|
107
|
-
/**
|
|
108
|
-
* Specify the user defined array of input data
|
|
109
|
-
* @param inputDataArr: array of tuples (date, val) where date is a date object or string in YYYY-MM-DD format and val is the value/counts for that date
|
|
110
|
-
*/
|
|
111
|
-
GetTopCorrelations.prototype.setCustomInputData = function (inputDataArr) {
|
|
112
|
-
var e_1, _a;
|
|
113
|
-
this.clearVal("testData");
|
|
114
|
-
try {
|
|
115
|
-
for (var inputDataArr_1 = __values(inputDataArr), inputDataArr_1_1 = inputDataArr_1.next(); !inputDataArr_1_1.done; inputDataArr_1_1 = inputDataArr_1.next()) {
|
|
116
|
-
var _b = inputDataArr_1_1.value, date = _b.date, val = _b.val;
|
|
117
|
-
if (!_.isNumber(val)) {
|
|
118
|
-
throw new Error("Value is expected to be a number");
|
|
119
|
-
}
|
|
120
|
-
this.addArrayVal("testData", { date: base_1.QueryParamsBase.encodeDateTime(date), count: val });
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
124
|
-
finally {
|
|
125
|
-
try {
|
|
126
|
-
if (inputDataArr_1_1 && !inputDataArr_1_1.done && (_a = inputDataArr_1.return)) _a.call(inputDataArr_1);
|
|
127
|
-
}
|
|
128
|
-
finally { if (e_1) throw e_1.error; }
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
/**
|
|
132
|
-
* Use the queryArticles to find articles that match the criteria. For the articles that match
|
|
133
|
-
* criteria in queryArticles compute the time-series (number of resulting articles for each date)
|
|
134
|
-
* an use the time series as the input data.
|
|
135
|
-
* @param queryArticles An instance of QueryArticles class, containing the conditions that are use to find the matching time-series. You don't need to specify any requested result.
|
|
136
|
-
*/
|
|
137
|
-
GetTopCorrelations.prototype.loadInputDataWithQuery = function (queryArticles) {
|
|
138
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
139
|
-
var e_2, _a, requestArticlesTimeAggr, response, _b, _c, object;
|
|
140
|
-
return __generator(this, function (_d) {
|
|
141
|
-
switch (_d.label) {
|
|
142
|
-
case 0:
|
|
143
|
-
this.clearVal("testData");
|
|
144
|
-
if (!(queryArticles instanceof queryArticles_1.QueryArticles)) {
|
|
145
|
-
throw new Error("'queryArticles' expected to be an instance of QueryArticles");
|
|
146
|
-
}
|
|
147
|
-
requestArticlesTimeAggr = new queryArticles_1.RequestArticlesTimeAggr();
|
|
148
|
-
queryArticles.setRequestedResult(requestArticlesTimeAggr);
|
|
149
|
-
return [4 /*yield*/, this.er.execQuery(queryArticles)];
|
|
150
|
-
case 1:
|
|
151
|
-
response = _d.sent();
|
|
152
|
-
if (_.has(response, "timeAggr")) {
|
|
153
|
-
try {
|
|
154
|
-
// Potential issue if response["timeAggr"] is an object
|
|
155
|
-
for (_b = __values(response["timeAggr"]), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
156
|
-
object = _c.value;
|
|
157
|
-
this.addArrayVal("testData", JSON.stringify(object));
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
161
|
-
finally {
|
|
162
|
-
try {
|
|
163
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
164
|
-
}
|
|
165
|
-
finally { if (e_2) throw e_2.error; }
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return [2 /*return*/];
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
};
|
|
173
|
-
/**
|
|
174
|
-
* Use GetCounts class to obtain daily counts information for concept/category of interest.
|
|
175
|
-
* @param getCounts An instance of GetCounts class.
|
|
176
|
-
*/
|
|
177
|
-
GetTopCorrelations.prototype.loadInputDataWithCounts = function (getCounts) {
|
|
178
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
179
|
-
var e_3, _a, response, key, _b, _c, object;
|
|
180
|
-
return __generator(this, function (_d) {
|
|
181
|
-
switch (_d.label) {
|
|
182
|
-
case 0:
|
|
183
|
-
this.clearVal("testData");
|
|
184
|
-
if (!(getCounts instanceof counts_1.GetCounts)) {
|
|
185
|
-
throw new Error("'getCounts' is expected to be an instance of GetCounts");
|
|
186
|
-
}
|
|
187
|
-
return [4 /*yield*/, this.er.execQuery(getCounts)];
|
|
188
|
-
case 1:
|
|
189
|
-
response = _d.sent();
|
|
190
|
-
if (_.size(response) > 1) {
|
|
191
|
-
throw new Error("The returned object had multiple keys. When creating the GetCounts instance use only one uri.");
|
|
192
|
-
}
|
|
193
|
-
if (_.isEmpty(response)) {
|
|
194
|
-
throw new Error("Obtained an empty object");
|
|
195
|
-
}
|
|
196
|
-
if (_.has(response, "error")) {
|
|
197
|
-
throw new Error(_.get(response, "error"));
|
|
198
|
-
}
|
|
199
|
-
key = _.first(_.keys(response));
|
|
200
|
-
if (!_.isArray(response[key])) {
|
|
201
|
-
throw new Error("Expected an array");
|
|
202
|
-
}
|
|
203
|
-
try {
|
|
204
|
-
for (_b = __values(response[key]), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
205
|
-
object = _c.value;
|
|
206
|
-
this.addArrayVal("testData", JSON.stringify(object));
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
210
|
-
finally {
|
|
211
|
-
try {
|
|
212
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
213
|
-
}
|
|
214
|
-
finally { if (e_3) throw e_3.error; }
|
|
215
|
-
}
|
|
216
|
-
return [2 /*return*/];
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
};
|
|
221
|
-
/**
|
|
222
|
-
* Do we have valid input data (needed before we can compute correlations)
|
|
223
|
-
*/
|
|
224
|
-
GetTopCorrelations.prototype.hasValidInputData = function () {
|
|
225
|
-
return this.hasVal("testData");
|
|
226
|
-
};
|
|
227
|
-
/**
|
|
228
|
-
* Compute concepts that correlate the most with the input data. If candidateConceptsQuery is provided we first identify the
|
|
229
|
-
* concepts that are potentially returned as top correlations. Candidates are obtained by making the query and analyzing the
|
|
230
|
-
* concepts that appear in the resulting articles. The top concepts are used as candidates among which we return the top correlations.
|
|
231
|
-
* If conceptType is provided then only concepts of the specified type can be provided as the result.
|
|
232
|
-
*
|
|
233
|
-
* @param args Object which contains a host of optional parameters
|
|
234
|
-
*/
|
|
235
|
-
GetTopCorrelations.prototype.getTopConceptCorrelations = function (args) {
|
|
236
|
-
if (args === void 0) { args = {}; }
|
|
237
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
238
|
-
var e_4, _a, _b, candidateConceptsQuery, _c, candidatesPerType, _d, conceptType, _e, exactCount, _f, approxCount, _g, returnInfo, getTopCorrelations, response, res, corrs, conceptIds, conceptInfos_1, _h, _j, i, ids, q, info, e_4_1;
|
|
239
|
-
return __generator(this, function (_k) {
|
|
240
|
-
switch (_k.label) {
|
|
241
|
-
case 0:
|
|
242
|
-
_b = args.candidateConceptsQuery, candidateConceptsQuery = _b === void 0 ? undefined : _b, _c = args.candidatesPerType, candidatesPerType = _c === void 0 ? 1000 : _c, _d = args.conceptType, conceptType = _d === void 0 ? undefined : _d, _e = args.exactCount, exactCount = _e === void 0 ? 10 : _e, _f = args.approxCount, approxCount = _f === void 0 ? 0 : _f, _g = args.returnInfo, returnInfo = _g === void 0 ? new returnInfo_1.ReturnInfo() : _g;
|
|
243
|
-
this.clearVal("contextConceptIds");
|
|
244
|
-
getTopCorrelations = _.cloneDeep(this);
|
|
245
|
-
if (!!_.isUndefined(candidateConceptsQuery)) return [3 /*break*/, 2];
|
|
246
|
-
if (!(candidateConceptsQuery instanceof (queryArticles_1.QueryArticles))) {
|
|
247
|
-
throw new Error("'candidateConceptsQuery' is expected to be of type QueryArticles");
|
|
248
|
-
}
|
|
249
|
-
candidateConceptsQuery.setRequestedResult(new queryArticles_1.RequestArticlesConceptAggr());
|
|
250
|
-
candidateConceptsQuery.setVal("conceptAggrConceptCountPerType", candidatesPerType);
|
|
251
|
-
candidateConceptsQuery.setVal("conceptAggrConceptIdOnly", true);
|
|
252
|
-
return [4 /*yield*/, this.er.execQuery(candidateConceptsQuery)];
|
|
253
|
-
case 1:
|
|
254
|
-
response = _k.sent();
|
|
255
|
-
if (_.has(response, "conceptAggr")) {
|
|
256
|
-
getTopCorrelations.setVal("contextConceptIds", _.join(response["conceptAggr"], ","));
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
console.warn("Warning: Failed to compute a candidate set of concepts");
|
|
260
|
-
}
|
|
261
|
-
_k.label = 2;
|
|
262
|
-
case 2:
|
|
263
|
-
if (conceptType) {
|
|
264
|
-
getTopCorrelations.setVal("conceptType", conceptType);
|
|
265
|
-
}
|
|
266
|
-
getTopCorrelations.setVal("exactCount", exactCount);
|
|
267
|
-
getTopCorrelations.setVal("approxCount", approxCount);
|
|
268
|
-
getTopCorrelations.setVal("sourceType", "news-concept");
|
|
269
|
-
return [4 /*yield*/, this.er.jsonRequest(this.path, getTopCorrelations.params)];
|
|
270
|
-
case 3:
|
|
271
|
-
res = _k.sent();
|
|
272
|
-
if (!!_.isUndefined(returnInfo)) return [3 /*break*/, 12];
|
|
273
|
-
corrs = __spread(_.get(res, "news-concept.exactCorrelations", []), _.get(res, "news-concept.approximateCorrelations", []));
|
|
274
|
-
conceptIds = _.map(corrs, "id");
|
|
275
|
-
conceptInfos_1 = {};
|
|
276
|
-
_k.label = 4;
|
|
277
|
-
case 4:
|
|
278
|
-
_k.trys.push([4, 9, 10, 11]);
|
|
279
|
-
_h = __values(_.range(0, _.size(conceptIds), 500)), _j = _h.next();
|
|
280
|
-
_k.label = 5;
|
|
281
|
-
case 5:
|
|
282
|
-
if (!!_j.done) return [3 /*break*/, 8];
|
|
283
|
-
i = _j.value;
|
|
284
|
-
ids = _.slice(conceptIds, i, i + 500);
|
|
285
|
-
q = new info_1.GetConceptInfo({ returnInfo: returnInfo });
|
|
286
|
-
// @ts-ignore
|
|
287
|
-
q.queryById(ids);
|
|
288
|
-
return [4 /*yield*/, this.er.execQuery(q)];
|
|
289
|
-
case 6:
|
|
290
|
-
info = _k.sent();
|
|
291
|
-
conceptInfos_1 = _.extend({}, conceptInfos_1, info);
|
|
292
|
-
_k.label = 7;
|
|
293
|
-
case 7:
|
|
294
|
-
_j = _h.next();
|
|
295
|
-
return [3 /*break*/, 5];
|
|
296
|
-
case 8: return [3 /*break*/, 11];
|
|
297
|
-
case 9:
|
|
298
|
-
e_4_1 = _k.sent();
|
|
299
|
-
e_4 = { error: e_4_1 };
|
|
300
|
-
return [3 /*break*/, 11];
|
|
301
|
-
case 10:
|
|
302
|
-
try {
|
|
303
|
-
if (_j && !_j.done && (_a = _h.return)) _a.call(_h);
|
|
304
|
-
}
|
|
305
|
-
finally { if (e_4) throw e_4.error; }
|
|
306
|
-
return [7 /*endfinally*/];
|
|
307
|
-
case 11:
|
|
308
|
-
if (_.has(res, "news-concept.exactCorrelations")) {
|
|
309
|
-
_.update(res, "news-concept.exactCorrelations", function (items) {
|
|
310
|
-
return _.map(items, function (item) {
|
|
311
|
-
item["conceptInfo"] = _.get(conceptInfos_1, item["id"], {});
|
|
312
|
-
return item;
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
if (_.has(res, "news-concept.approximateCorrelations")) {
|
|
317
|
-
_.update(res, "news-concept.approximateCorrelations", function (items) {
|
|
318
|
-
return _.map(items, function (item) {
|
|
319
|
-
item["conceptInfo"] = _.get(conceptInfos_1, item["id"], {});
|
|
320
|
-
return item;
|
|
321
|
-
});
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
_k.label = 12;
|
|
325
|
-
case 12: return [2 /*return*/, res];
|
|
326
|
-
}
|
|
327
|
-
});
|
|
328
|
-
});
|
|
329
|
-
};
|
|
330
|
-
/**
|
|
331
|
-
* Compute categories that correlate the most with the input data.
|
|
332
|
-
* @param args Object which contains a host of optional parameters
|
|
333
|
-
*/
|
|
334
|
-
GetTopCorrelations.prototype.getTopCategoryCorrelations = function (args) {
|
|
335
|
-
if (args === void 0) { args = {}; }
|
|
336
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
337
|
-
var e_5, _a, _b, exactCount, _c, approxCount, _d, returnInfo, getTopCorrelations, res, corrs, categoryIds, categoryInfos_1, _e, _f, i, ids, q, info;
|
|
338
|
-
return __generator(this, function (_g) {
|
|
339
|
-
switch (_g.label) {
|
|
340
|
-
case 0:
|
|
341
|
-
_b = args.exactCount, exactCount = _b === void 0 ? 10 : _b, _c = args.approxCount, approxCount = _c === void 0 ? 0 : _c, _d = args.returnInfo, returnInfo = _d === void 0 ? new returnInfo_1.ReturnInfo() : _d;
|
|
342
|
-
getTopCorrelations = _.cloneDeep(this);
|
|
343
|
-
getTopCorrelations.clearVal("contextConceptIds");
|
|
344
|
-
getTopCorrelations.setVal("exactCount", exactCount);
|
|
345
|
-
getTopCorrelations.setVal("approxCount", approxCount);
|
|
346
|
-
getTopCorrelations.setVal("sourceType", "news-category");
|
|
347
|
-
return [4 /*yield*/, this.er.jsonRequest(this.path, getTopCorrelations.params)];
|
|
348
|
-
case 1:
|
|
349
|
-
res = _g.sent();
|
|
350
|
-
if (!_.isUndefined(returnInfo)) {
|
|
351
|
-
corrs = __spread(_.get(res, "news-category.exactCorrelations", []), _.get(res, "news-category.approximateCorrelations", []));
|
|
352
|
-
categoryIds = _.map(corrs, "id");
|
|
353
|
-
categoryInfos_1 = {};
|
|
354
|
-
try {
|
|
355
|
-
for (_e = __values(_.range(0, _.size(categoryIds), 500)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
356
|
-
i = _f.value;
|
|
357
|
-
ids = _.slice(categoryIds, i, i + 500);
|
|
358
|
-
q = new info_1.GetCategoryInfo({ returnInfo: returnInfo });
|
|
359
|
-
// @ts-ignore
|
|
360
|
-
q.queryById(ids);
|
|
361
|
-
info = this.er.execQuery(q);
|
|
362
|
-
categoryInfos_1 = _.extend({}, categoryInfos_1, info);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
366
|
-
finally {
|
|
367
|
-
try {
|
|
368
|
-
if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
|
|
369
|
-
}
|
|
370
|
-
finally { if (e_5) throw e_5.error; }
|
|
371
|
-
}
|
|
372
|
-
if (_.has(res, "news-category.exactCorrelations")) {
|
|
373
|
-
_.update(res, "news-category.exactCorrelations", function (items) {
|
|
374
|
-
return _.map(items, function (item) {
|
|
375
|
-
item["categoryInfo"] = _.get(categoryInfos_1, item["id"], {});
|
|
376
|
-
return item;
|
|
377
|
-
});
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
if (_.has(res, "news-category.approximateCorrelations")) {
|
|
381
|
-
_.update(res, "news-category.approximateCorrelations", function (items) {
|
|
382
|
-
return _.map(items, function (item) {
|
|
383
|
-
item["categoryInfo"] = _.get(categoryInfos_1, item["id"], {});
|
|
384
|
-
return item;
|
|
385
|
-
});
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
return [2 /*return*/, res];
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
});
|
|
393
|
-
};
|
|
394
|
-
return GetTopCorrelations;
|
|
395
|
-
}(base_1.QueryParamsBase));
|
|
396
|
-
exports.GetTopCorrelations = GetTopCorrelations;
|
|
397
|
-
//# sourceMappingURL=correlations.js.map
|
package/dist/correlations.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"correlations.js","sourceRoot":"","sources":["../src/correlations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0BAA4B;AAC5B,+BAAyC;AACzC,mCAAqC;AAErC,+BAAyD;AACzD,iDAAqG;AACrG,2CAA0C;AAG1C;;;;GAIG;AACH;IAAwC,sCAAe;IAEnD,4BAAY,EAAiB;QAA7B,YACI,iBAAO,SAGV;QAFG,KAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,KAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;;IACjD,CAAC;IAED,sBAAW,oCAAI;aAAf;YACI,OAAO,iBAAiB,CAAC;QAC7B,CAAC;;;OAAA;IACD;;;OAGG;IACI,+CAAkB,GAAzB,UAA0B,YAAY;;QAClC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;;YAC1B,KAA0B,IAAA,iBAAA,SAAA,YAAY,CAAA,0CAAA,oEAAE;gB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AAE,eAAa,EAAE,IAAI,CAAC,CAAC;iCACrD;;;;;;;;;4BACD,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,iCAAiC,CAAC,EAAE;gCAC/C,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,iCAAiC,EAAE,UAAC,KAAK;oCACnD,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,UAAC,IAAI;wCACrB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,eAAa,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;wCAC5D,OAAO,IAAI,CAAC;oCAChB,CAAC,CAAC,CAAC;gCACP,CAAC,CAAC,CAAC;6BACN;4BACD,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,uCAAuC,CAAC,EAAE;gCACrD,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,uCAAuC,EAAE,UAAC,KAAK;oCACzD,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,UAAC,IAAI;wCACrB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,eAAa,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;wCAC5D,OAAO,IAAI,CAAC;oCAChB,CAAC,CAAC,CAAC;gCACP,CAAC,CAAC,CAAC;6BACN;yBACJ;wBACD,sBAAO,GAAU,EAAC;;;;KACrB;IACL,yBAAC;AAAD,CAAC,AArMD,CAAwC,sBAAe,GAqMtD;AArMY,gDAAkB"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { EventRegistry } from "eventregistry";
|
|
2
|
-
|
|
3
|
-
// examples showing how to use the autosuggest functionalities for
|
|
4
|
-
// concepts, sources, categories, locations, ....
|
|
5
|
-
|
|
6
|
-
const er = new EventRegistry();
|
|
7
|
-
|
|
8
|
-
// get concept uris for concepts based on the concept labels
|
|
9
|
-
er.suggestConcepts("Obama", {lang: "eng", conceptLang: ["eng", "deu"]}).then((response) => {
|
|
10
|
-
console.info(response);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
// get only the top concept that best matches the prefix
|
|
14
|
-
er.getConceptUri("Obama").then((response) => {
|
|
15
|
-
console.info(`A URI of the top concept that contains the term 'Obama': ${response}`);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// return a list of categories that contain text "Business"
|
|
19
|
-
er.suggestCategories("Business").then((response) => {
|
|
20
|
-
console.info(response);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// return the top category that contains text "Business"
|
|
24
|
-
er.getCategoryUri("Business").then((response) => {
|
|
25
|
-
console.info(`A URI of the top category that contains the term 'Business': ${response}`);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
// get a list of locations that best match the prefix "Lond"
|
|
29
|
-
er.suggestLocations("Lond").then((response) => {
|
|
30
|
-
console.info(response);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
// get a top location that best matches the prefix "Lond"
|
|
34
|
-
er.getLocationUri("Lond").then((response) => {
|
|
35
|
-
console.info(`A top location that contains text 'Lond': ${response}`);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
// get a top location for "lond" that is located in USA
|
|
39
|
-
er.getLocationUri("united states", {sources: "country"}).then((response) => {
|
|
40
|
-
console.info(response);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
// suggest a list of concept classes that best match the text "auto"
|
|
44
|
-
er.suggestConceptClasses("auto").then((response) => {
|
|
45
|
-
console.info(response);
|
|
46
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { EventRegistry, GetCounts, GetCountsEx } from "eventregistry";
|
|
2
|
-
|
|
3
|
-
// examples showing how to obtain information how frequently a particular concept is mentioined in
|
|
4
|
-
// the news articles, or an article is about a particular category
|
|
5
|
-
|
|
6
|
-
const er = new EventRegistry();
|
|
7
|
-
|
|
8
|
-
Promise.all([er.getConceptUri("Trump"), er.getConceptUri("ebola")]).then((conceptUris) => {
|
|
9
|
-
const q = new GetCounts(conceptUris, {dateStart: "2015-05-15", dateEnd: "2015-05-20"});
|
|
10
|
-
er.execQuery(q).then((response) => {
|
|
11
|
-
console.info(response);
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
er.getCategoryUri("Business").then((categoryUri) => {
|
|
16
|
-
const q = new GetCountsEx([categoryUri], {type: "category"});
|
|
17
|
-
er.execQuery(q).then((response) => {
|
|
18
|
-
console.info(response);
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
// get geographic spreadness of the concept Obama
|
|
22
|
-
er.getCategoryUri("Obama").then((conceptUri) => {
|
|
23
|
-
const q = new GetCounts([conceptUri], {source: "geo"});
|
|
24
|
-
er.execQuery(q).then((response) => {
|
|
25
|
-
console.info(response);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
// get the sentiment expressed about Obama
|
|
29
|
-
er.getCategoryUri("Obama").then((conceptUri) => {
|
|
30
|
-
const q = new GetCounts([conceptUri], {source: "sentiment"});
|
|
31
|
-
er.execQuery(q).then((response) => {
|
|
32
|
-
console.info(response);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ArticleInfoFlags,
|
|
3
|
-
EventInfoFlags,
|
|
4
|
-
EventRegistry,
|
|
5
|
-
GetTopSharedArticles,
|
|
6
|
-
GetTopSharedEvents,
|
|
7
|
-
QueryArticles,
|
|
8
|
-
QueryEvents,
|
|
9
|
-
RequestArticlesInfo,
|
|
10
|
-
RequestEventsInfo,
|
|
11
|
-
ReturnInfo,
|
|
12
|
-
} from "eventregistry";
|
|
13
|
-
|
|
14
|
-
// examples to obtain information what are the top fb shared articles on a particular day or
|
|
15
|
-
// what are the events, for which the articles were shared the most
|
|
16
|
-
|
|
17
|
-
const er = new EventRegistry();
|
|
18
|
-
|
|
19
|
-
const q1 = new GetTopSharedArticles({date: "2015-03-01", count: 30, returnInfo: new ReturnInfo({articleInfo: new ArticleInfoFlags({socialScore: true})})});
|
|
20
|
-
er.execQuery(q1).then((response) => {
|
|
21
|
-
console.info(response);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
// get top shared events for a date
|
|
25
|
-
const q2 = new GetTopSharedEvents({date: "2015-05-23", count: 30, returnInfo: new ReturnInfo({eventInfo: new EventInfoFlags({socialScore: true})})});
|
|
26
|
-
er.execQuery(q2).then((response) => {
|
|
27
|
-
console.info(response);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// get social shared information for resulting articles
|
|
31
|
-
er.getConceptUri("Apple").then((conceptUri) => {
|
|
32
|
-
const q3 = new QueryArticles({ conceptUri });
|
|
33
|
-
const returnInfo = new ReturnInfo({articleInfo: new ArticleInfoFlags({socialScore: true})});
|
|
34
|
-
const requestArticlesInfo = new RequestArticlesInfo({
|
|
35
|
-
count: 5,
|
|
36
|
-
sortBy: "socialScore",
|
|
37
|
-
returnInfo: returnInfo,
|
|
38
|
-
});
|
|
39
|
-
q3.setRequestedResult(requestArticlesInfo);
|
|
40
|
-
return er.execQuery(q3);
|
|
41
|
-
}).then((response) => {
|
|
42
|
-
console.info(response);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// get social shared information for resulting events
|
|
46
|
-
er.getConceptUri("Apple").then((conceptUri) => {
|
|
47
|
-
const q4 = new QueryEvents({ conceptUri });
|
|
48
|
-
const returnInfo = new ReturnInfo({articleInfo: new ArticleInfoFlags({socialScore: true})});
|
|
49
|
-
const requestEventsInfo = new RequestEventsInfo({count: 5, sortBy: "socialScore", returnInfo: returnInfo});
|
|
50
|
-
q4.setRequestedResult(requestEventsInfo);
|
|
51
|
-
return er.execQuery(q4);
|
|
52
|
-
}).then((response) => {
|
|
53
|
-
console.info(response);
|
|
54
|
-
});
|