eventregistry 9.1.0 → 10.0.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/CHANGELOG.md +207 -0
- package/LICENSE +21 -21
- package/MIGRATION.md +177 -0
- package/README.md +292 -234
- package/dist/{analytics.d.ts → cjs/analytics.d.ts} +2 -1
- package/dist/cjs/analytics.js +174 -0
- package/dist/cjs/analytics.js.map +1 -0
- package/dist/{base.d.ts → cjs/base.d.ts} +9 -9
- package/dist/cjs/base.js +189 -0
- package/dist/cjs/base.js.map +1 -0
- package/dist/cjs/counts.js +120 -0
- package/dist/cjs/counts.js.map +1 -0
- package/dist/cjs/dailyShares.js +46 -0
- package/dist/cjs/dailyShares.js.map +1 -0
- package/dist/{data.d.ts → cjs/data.d.ts} +32 -5
- package/dist/cjs/data.js.map +1 -0
- package/dist/{eventForText.d.ts → cjs/eventForText.d.ts} +1 -1
- package/dist/cjs/eventForText.js +61 -0
- package/dist/cjs/eventForText.js.map +1 -0
- package/dist/{eventRegistry.d.ts → cjs/eventRegistry.d.ts} +127 -28
- package/dist/cjs/eventRegistry.js +887 -0
- package/dist/cjs/eventRegistry.js.map +1 -0
- package/dist/cjs/fluent/analytics.d.ts +24 -0
- package/dist/cjs/fluent/analytics.js +47 -0
- package/dist/cjs/fluent/analytics.js.map +1 -0
- package/dist/cjs/fluent/articles.d.ts +23 -0
- package/dist/cjs/fluent/articles.js +34 -0
- package/dist/cjs/fluent/articles.js.map +1 -0
- package/dist/cjs/fluent/counts.d.ts +8 -0
- package/dist/cjs/fluent/counts.js +17 -0
- package/dist/cjs/fluent/counts.js.map +1 -0
- package/dist/cjs/fluent/eventForText.d.ts +4 -0
- package/dist/cjs/fluent/eventForText.js +8 -0
- package/dist/cjs/fluent/eventForText.js.map +1 -0
- package/dist/cjs/fluent/events.d.ts +23 -0
- package/dist/cjs/fluent/events.js +34 -0
- package/dist/cjs/fluent/events.js.map +1 -0
- package/dist/cjs/fluent/info.d.ts +10 -0
- package/dist/cjs/fluent/info.js +23 -0
- package/dist/cjs/fluent/info.js.map +1 -0
- package/dist/cjs/fluent/mentions.d.ts +18 -0
- package/dist/cjs/fluent/mentions.js +31 -0
- package/dist/cjs/fluent/mentions.js.map +1 -0
- package/dist/cjs/fluent/recent.d.ts +8 -0
- package/dist/cjs/fluent/recent.js +17 -0
- package/dist/cjs/fluent/recent.js.map +1 -0
- package/dist/cjs/fluent/shares.d.ts +8 -0
- package/dist/cjs/fluent/shares.js +17 -0
- package/dist/cjs/fluent/shares.js.map +1 -0
- package/dist/cjs/fluent/stories.d.ts +8 -0
- package/dist/cjs/fluent/stories.js +14 -0
- package/dist/cjs/fluent/stories.js.map +1 -0
- package/dist/cjs/fluent/topicPages.d.ts +10 -0
- package/dist/cjs/fluent/topicPages.js +20 -0
- package/dist/cjs/fluent/topicPages.js.map +1 -0
- package/dist/cjs/fluent/trends.d.ts +11 -0
- package/dist/cjs/fluent/trends.js +23 -0
- package/dist/cjs/fluent/trends.js.map +1 -0
- package/dist/cjs/helpers/analytics.d.ts +68 -0
- package/dist/cjs/helpers/analytics.js +100 -0
- package/dist/cjs/helpers/analytics.js.map +1 -0
- package/dist/cjs/helpers/articles.d.ts +24 -0
- package/dist/cjs/helpers/articles.js +31 -0
- package/dist/cjs/helpers/articles.js.map +1 -0
- package/dist/cjs/helpers/counts.d.ts +4 -0
- package/dist/cjs/helpers/counts.js +12 -0
- package/dist/cjs/helpers/counts.js.map +1 -0
- package/dist/cjs/helpers/eventForText.d.ts +6 -0
- package/dist/cjs/helpers/eventForText.js +13 -0
- package/dist/cjs/helpers/eventForText.js.map +1 -0
- package/dist/cjs/helpers/events.d.ts +18 -0
- package/dist/cjs/helpers/events.js +31 -0
- package/dist/cjs/helpers/events.js.map +1 -0
- package/dist/cjs/helpers/info.d.ts +6 -0
- package/dist/cjs/helpers/info.js +20 -0
- package/dist/cjs/helpers/info.js.map +1 -0
- package/dist/cjs/helpers/mentions.d.ts +10 -0
- package/dist/cjs/helpers/mentions.js +21 -0
- package/dist/cjs/helpers/mentions.js.map +1 -0
- package/dist/cjs/helpers/recent.d.ts +10 -0
- package/dist/cjs/helpers/recent.js +18 -0
- package/dist/cjs/helpers/recent.js.map +1 -0
- package/dist/cjs/helpers/shares.d.ts +4 -0
- package/dist/cjs/helpers/shares.js +12 -0
- package/dist/cjs/helpers/shares.js.map +1 -0
- package/dist/cjs/helpers/stories.d.ts +7 -0
- package/dist/cjs/helpers/stories.js +13 -0
- package/dist/cjs/helpers/stories.js.map +1 -0
- package/dist/cjs/helpers/topicPages.d.ts +16 -0
- package/dist/cjs/helpers/topicPages.js +29 -0
- package/dist/cjs/helpers/topicPages.js.map +1 -0
- package/dist/cjs/helpers/trends.d.ts +7 -0
- package/dist/cjs/helpers/trends.js +20 -0
- package/dist/cjs/helpers/trends.js.map +1 -0
- package/dist/cjs/helpers/uri.d.ts +42 -0
- package/dist/cjs/helpers/uri.js +78 -0
- package/dist/cjs/helpers/uri.js.map +1 -0
- package/dist/cjs/http.d.ts +18 -0
- package/dist/cjs/http.js +88 -0
- package/dist/cjs/http.js.map +1 -0
- package/dist/cjs/index.d.ts +47 -0
- package/dist/{index.js → cjs/index.js} +90 -2
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/info.js +115 -0
- package/dist/cjs/info.js.map +1 -0
- package/dist/{logger.d.ts → cjs/logger.d.ts} +13 -10
- package/dist/cjs/logger.js +179 -0
- package/dist/cjs/logger.js.map +1 -0
- package/dist/cjs/mutex.d.ts +6 -0
- package/dist/cjs/mutex.js +27 -0
- package/dist/cjs/mutex.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/{query.d.ts → cjs/query.d.ts} +5 -8
- package/dist/cjs/query.js +248 -0
- package/dist/cjs/query.js.map +1 -0
- package/dist/{queryArticle.d.ts → cjs/queryArticle.d.ts} +5 -5
- package/dist/cjs/queryArticle.js +120 -0
- package/dist/cjs/queryArticle.js.map +1 -0
- package/dist/{queryArticles.d.ts → cjs/queryArticles.d.ts} +40 -73
- package/dist/cjs/queryArticles.js +456 -0
- package/dist/cjs/queryArticles.js.map +1 -0
- package/dist/{queryEvent.d.ts → cjs/queryEvent.d.ts} +6 -6
- package/dist/cjs/queryEvent.js +417 -0
- package/dist/cjs/queryEvent.js.map +1 -0
- package/dist/{queryEvents.d.ts → cjs/queryEvents.d.ts} +30 -39
- package/dist/cjs/queryEvents.js +567 -0
- package/dist/cjs/queryEvents.js.map +1 -0
- package/dist/cjs/queryIterator.d.ts +34 -0
- package/dist/cjs/queryIterator.js +77 -0
- package/dist/cjs/queryIterator.js.map +1 -0
- package/dist/{queryMentions.d.ts → cjs/queryMentions.d.ts} +18 -18
- package/dist/cjs/queryMentions.js +440 -0
- package/dist/cjs/queryMentions.js.map +1 -0
- package/dist/{queryStory.d.ts → cjs/queryStory.d.ts} +23 -23
- package/dist/cjs/queryStory.js +120 -0
- package/dist/cjs/queryStory.js.map +1 -0
- package/dist/{recent.d.ts → cjs/recent.d.ts} +8 -8
- package/dist/cjs/recent.js +63 -0
- package/dist/cjs/recent.js.map +1 -0
- package/dist/{returnInfo.d.ts → cjs/returnInfo.d.ts} +21 -23
- package/dist/cjs/returnInfo.js +292 -0
- package/dist/cjs/returnInfo.js.map +1 -0
- package/dist/{topicPage.d.ts → cjs/topicPage.d.ts} +3 -3
- package/dist/cjs/topicPage.js +454 -0
- package/dist/cjs/topicPage.js.map +1 -0
- package/dist/cjs/topicPages.d.ts +13 -0
- package/dist/cjs/topicPages.js +22 -0
- package/dist/cjs/topicPages.js.map +1 -0
- package/dist/{trends.d.ts → cjs/trends.d.ts} +13 -13
- package/dist/cjs/trends.js +64 -0
- package/dist/cjs/trends.js.map +1 -0
- package/dist/{types.d.ts → cjs/types.d.ts} +135 -33
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/version.d.ts +1 -0
- package/dist/cjs/version.js +5 -0
- package/dist/cjs/version.js.map +1 -0
- package/dist/esm/analytics.d.ts +83 -0
- package/dist/esm/analytics.js +170 -0
- package/dist/esm/analytics.js.map +1 -0
- package/dist/esm/base.d.ts +82 -0
- package/dist/esm/base.js +182 -0
- package/dist/esm/base.js.map +1 -0
- package/dist/esm/counts.d.ts +81 -0
- package/dist/esm/counts.js +114 -0
- package/dist/esm/counts.js.map +1 -0
- package/dist/esm/dailyShares.d.ts +10 -0
- package/dist/esm/dailyShares.js +41 -0
- package/dist/esm/dailyShares.js.map +1 -0
- package/dist/esm/data.d.ts +296 -0
- package/dist/esm/data.js +3 -0
- package/dist/esm/data.js.map +1 -0
- package/dist/esm/eventForText.d.ts +48 -0
- package/dist/esm/eventForText.js +57 -0
- package/dist/esm/eventForText.js.map +1 -0
- package/dist/esm/eventRegistry.d.ts +343 -0
- package/dist/esm/eventRegistry.js +849 -0
- package/dist/esm/eventRegistry.js.map +1 -0
- package/dist/esm/fluent/analytics.d.ts +24 -0
- package/dist/esm/fluent/analytics.js +43 -0
- package/dist/esm/fluent/analytics.js.map +1 -0
- package/dist/esm/fluent/articles.d.ts +23 -0
- package/dist/esm/fluent/articles.js +30 -0
- package/dist/esm/fluent/articles.js.map +1 -0
- package/dist/esm/fluent/counts.d.ts +8 -0
- package/dist/esm/fluent/counts.js +13 -0
- package/dist/esm/fluent/counts.js.map +1 -0
- package/dist/esm/fluent/eventForText.d.ts +4 -0
- package/dist/esm/fluent/eventForText.js +5 -0
- package/dist/esm/fluent/eventForText.js.map +1 -0
- package/dist/esm/fluent/events.d.ts +23 -0
- package/dist/esm/fluent/events.js +30 -0
- package/dist/esm/fluent/events.js.map +1 -0
- package/dist/esm/fluent/info.d.ts +10 -0
- package/dist/esm/fluent/info.js +19 -0
- package/dist/esm/fluent/info.js.map +1 -0
- package/dist/esm/fluent/mentions.d.ts +18 -0
- package/dist/esm/fluent/mentions.js +27 -0
- package/dist/esm/fluent/mentions.js.map +1 -0
- package/dist/esm/fluent/recent.d.ts +8 -0
- package/dist/esm/fluent/recent.js +13 -0
- package/dist/esm/fluent/recent.js.map +1 -0
- package/dist/esm/fluent/shares.d.ts +8 -0
- package/dist/esm/fluent/shares.js +13 -0
- package/dist/esm/fluent/shares.js.map +1 -0
- package/dist/esm/fluent/stories.d.ts +8 -0
- package/dist/esm/fluent/stories.js +10 -0
- package/dist/esm/fluent/stories.js.map +1 -0
- package/dist/esm/fluent/topicPages.d.ts +10 -0
- package/dist/esm/fluent/topicPages.js +16 -0
- package/dist/esm/fluent/topicPages.js.map +1 -0
- package/dist/esm/fluent/trends.d.ts +11 -0
- package/dist/esm/fluent/trends.js +19 -0
- package/dist/esm/fluent/trends.js.map +1 -0
- package/dist/esm/helpers/analytics.d.ts +68 -0
- package/dist/esm/helpers/analytics.js +86 -0
- package/dist/esm/helpers/analytics.js.map +1 -0
- package/dist/esm/helpers/articles.d.ts +24 -0
- package/dist/esm/helpers/articles.js +26 -0
- package/dist/esm/helpers/articles.js.map +1 -0
- package/dist/esm/helpers/counts.d.ts +4 -0
- package/dist/esm/helpers/counts.js +8 -0
- package/dist/esm/helpers/counts.js.map +1 -0
- package/dist/esm/helpers/eventForText.d.ts +6 -0
- package/dist/esm/helpers/eventForText.js +10 -0
- package/dist/esm/helpers/eventForText.js.map +1 -0
- package/dist/esm/helpers/events.d.ts +18 -0
- package/dist/esm/helpers/events.js +26 -0
- package/dist/esm/helpers/events.js.map +1 -0
- package/dist/esm/helpers/info.d.ts +6 -0
- package/dist/esm/helpers/info.js +14 -0
- package/dist/esm/helpers/info.js.map +1 -0
- package/dist/esm/helpers/mentions.d.ts +10 -0
- package/dist/esm/helpers/mentions.js +17 -0
- package/dist/esm/helpers/mentions.js.map +1 -0
- package/dist/esm/helpers/recent.d.ts +10 -0
- package/dist/esm/helpers/recent.js +14 -0
- package/dist/esm/helpers/recent.js.map +1 -0
- package/dist/esm/helpers/shares.d.ts +4 -0
- package/dist/esm/helpers/shares.js +8 -0
- package/dist/esm/helpers/shares.js.map +1 -0
- package/dist/esm/helpers/stories.d.ts +7 -0
- package/dist/esm/helpers/stories.js +10 -0
- package/dist/esm/helpers/stories.js.map +1 -0
- package/dist/esm/helpers/topicPages.d.ts +16 -0
- package/dist/esm/helpers/topicPages.js +24 -0
- package/dist/esm/helpers/topicPages.js.map +1 -0
- package/dist/esm/helpers/trends.d.ts +7 -0
- package/dist/esm/helpers/trends.js +14 -0
- package/dist/esm/helpers/trends.js.map +1 -0
- package/dist/esm/helpers/uri.d.ts +42 -0
- package/dist/esm/helpers/uri.js +68 -0
- package/dist/esm/helpers/uri.js.map +1 -0
- package/dist/esm/http.d.ts +18 -0
- package/dist/esm/http.js +85 -0
- package/dist/esm/http.js.map +1 -0
- package/dist/esm/index.d.ts +47 -0
- package/dist/esm/index.js +47 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/info.d.ts +61 -0
- package/dist/esm/info.js +108 -0
- package/dist/esm/info.js.map +1 -0
- package/dist/esm/logger.d.ts +47 -0
- package/dist/esm/logger.js +142 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/mutex.d.ts +6 -0
- package/dist/esm/mutex.js +23 -0
- package/dist/esm/mutex.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/query.d.ts +50 -0
- package/dist/esm/query.js +240 -0
- package/dist/esm/query.js.map +1 -0
- package/dist/esm/queryArticle.d.ts +61 -0
- package/dist/esm/queryArticle.js +111 -0
- package/dist/esm/queryArticle.js.map +1 -0
- package/dist/esm/queryArticles.d.ts +111 -0
- package/dist/esm/queryArticles.js +438 -0
- package/dist/esm/queryArticles.js.map +1 -0
- package/dist/esm/queryEvent.d.ts +140 -0
- package/dist/esm/queryEvent.js +403 -0
- package/dist/esm/queryEvent.js.map +1 -0
- package/dist/esm/queryEvents.d.ts +201 -0
- package/dist/esm/queryEvents.js +545 -0
- package/dist/esm/queryEvents.js.map +1 -0
- package/dist/esm/queryIterator.d.ts +34 -0
- package/dist/esm/queryIterator.js +73 -0
- package/dist/esm/queryIterator.js.map +1 -0
- package/dist/esm/queryMentions.d.ts +96 -0
- package/dist/esm/queryMentions.js +425 -0
- package/dist/esm/queryMentions.js.map +1 -0
- package/dist/esm/queryStory.d.ts +58 -0
- package/dist/esm/queryStory.js +110 -0
- package/dist/esm/queryStory.js.map +1 -0
- package/dist/esm/recent.d.ts +23 -0
- package/dist/esm/recent.js +58 -0
- package/dist/esm/recent.js.map +1 -0
- package/dist/esm/returnInfo.d.ts +66 -0
- package/dist/esm/returnInfo.js +245 -0
- package/dist/esm/returnInfo.js.map +1 -0
- package/dist/esm/topicPage.d.ts +157 -0
- package/dist/esm/topicPage.js +417 -0
- package/dist/esm/topicPage.js.map +1 -0
- package/dist/esm/topicPages.d.ts +13 -0
- package/dist/esm/topicPages.js +18 -0
- package/dist/esm/topicPages.js.map +1 -0
- package/dist/esm/trends.d.ts +35 -0
- package/dist/esm/trends.js +56 -0
- package/dist/esm/trends.js.map +1 -0
- package/dist/esm/types.d.ts +2555 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/version.d.ts +1 -0
- package/dist/esm/version.js +2 -0
- package/dist/esm/version.js.map +1 -0
- package/package.json +71 -42
- package/src/analytics.ts +197 -0
- package/src/base.ts +200 -0
- package/src/counts.ts +118 -0
- package/src/dailyShares.ts +46 -0
- package/src/data.ts +310 -0
- package/src/eventForText.ts +60 -0
- package/src/eventRegistry.ts +1005 -0
- package/src/fluent/analytics.ts +84 -0
- package/src/fluent/articles.ts +40 -0
- package/src/fluent/counts.ts +15 -0
- package/src/fluent/eventForText.ts +10 -0
- package/src/fluent/events.ts +40 -0
- package/src/fluent/info.ts +23 -0
- package/src/fluent/mentions.ts +34 -0
- package/src/fluent/recent.ts +15 -0
- package/src/fluent/shares.ts +15 -0
- package/src/fluent/stories.ts +12 -0
- package/src/fluent/topicPages.ts +20 -0
- package/src/fluent/trends.ts +34 -0
- package/src/helpers/analytics.ts +134 -0
- package/src/helpers/articles.ts +42 -0
- package/src/helpers/counts.ts +19 -0
- package/src/helpers/eventForText.ts +16 -0
- package/src/helpers/events.ts +43 -0
- package/src/helpers/info.ts +31 -0
- package/src/helpers/mentions.ts +27 -0
- package/src/helpers/recent.ts +22 -0
- package/src/helpers/shares.ts +17 -0
- package/src/helpers/stories.ts +16 -0
- package/src/helpers/topicPages.ts +28 -0
- package/src/helpers/trends.ts +36 -0
- package/src/helpers/uri.ts +78 -0
- package/src/http.ts +110 -0
- package/src/index.ts +205 -0
- package/src/info.ts +120 -0
- package/src/logger.ts +177 -0
- package/src/mutex.ts +22 -0
- package/src/query.ts +258 -0
- package/src/queryArticle.ts +138 -0
- package/src/queryArticles.ts +576 -0
- package/src/queryEvent.ts +503 -0
- package/src/queryEvents.ts +672 -0
- package/src/queryIterator.ts +89 -0
- package/src/queryMentions.ts +552 -0
- package/src/queryStory.ts +152 -0
- package/src/recent.ts +73 -0
- package/src/returnInfo.ts +372 -0
- package/src/topicPage.ts +481 -0
- package/src/topicPages.ts +18 -0
- package/src/trends.ts +62 -0
- package/src/types.ts +2678 -0
- package/src/version.ts +1 -0
- package/dist/analytics.js +0 -337
- package/dist/analytics.js.map +0 -1
- package/dist/base.js +0 -262
- package/dist/base.js.map +0 -1
- package/dist/counts.js +0 -163
- package/dist/counts.js.map +0 -1
- package/dist/dailyShares.js +0 -91
- package/dist/dailyShares.js.map +0 -1
- package/dist/data.js.map +0 -1
- package/dist/eventForText.js +0 -127
- package/dist/eventForText.js.map +0 -1
- package/dist/eventRegistry.js +0 -1099
- package/dist/eventRegistry.js.map +0 -1
- package/dist/index.d.ts +0 -21
- package/dist/index.js.map +0 -1
- package/dist/info.js +0 -172
- package/dist/info.js.map +0 -1
- package/dist/logger.js +0 -144
- package/dist/logger.js.map +0 -1
- package/dist/query.js +0 -334
- package/dist/query.js.map +0 -1
- package/dist/queryArticle.js +0 -184
- package/dist/queryArticle.js.map +0 -1
- package/dist/queryArticles.js +0 -730
- package/dist/queryArticles.js.map +0 -1
- package/dist/queryEvent.js +0 -588
- package/dist/queryEvent.js.map +0 -1
- package/dist/queryEvents.js +0 -826
- package/dist/queryEvents.js.map +0 -1
- package/dist/queryMentions.js +0 -638
- package/dist/queryMentions.js.map +0 -1
- package/dist/queryStory.js +0 -195
- package/dist/queryStory.js.map +0 -1
- package/dist/recent.js +0 -200
- package/dist/recent.js.map +0 -1
- package/dist/returnInfo.js +0 -333
- package/dist/returnInfo.js.map +0 -1
- package/dist/topicPage.js +0 -600
- package/dist/topicPage.js.map +0 -1
- package/dist/trends.js +0 -116
- package/dist/trends.js.map +0 -1
- package/dist/types.js.map +0 -1
- /package/dist/{counts.d.ts → cjs/counts.d.ts} +0 -0
- /package/dist/{dailyShares.d.ts → cjs/dailyShares.d.ts} +0 -0
- /package/dist/{data.js → cjs/data.js} +0 -0
- /package/dist/{info.d.ts → cjs/info.d.ts} +0 -0
- /package/dist/{types.js → cjs/types.js} +0 -0
|
@@ -43,34 +43,34 @@ export declare namespace ER {
|
|
|
43
43
|
*/
|
|
44
44
|
apiKey?: string;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* Host to use to access the Event Registry backend.
|
|
47
|
+
* @default "https://eventregistry.org"
|
|
47
48
|
*/
|
|
48
49
|
host?: string;
|
|
49
50
|
/**
|
|
50
|
-
*
|
|
51
|
+
* Host address to use to perform the analytics api calls.
|
|
52
|
+
* @default "https://analytics.eventregistry.org"
|
|
51
53
|
*/
|
|
52
54
|
hostAnalytics?: string;
|
|
53
55
|
/**
|
|
54
|
-
*
|
|
56
|
+
* Log all requests.
|
|
55
57
|
*/
|
|
56
58
|
logging?: boolean;
|
|
57
59
|
/**
|
|
58
|
-
* The minimum number of seconds between individual api calls
|
|
60
|
+
* The minimum number of seconds between individual api calls.
|
|
61
|
+
* @default 0.5
|
|
59
62
|
*/
|
|
60
63
|
minDelayBetweenRequests?: number;
|
|
61
64
|
/**
|
|
62
|
-
*
|
|
63
|
-
* what is the max number of times the request should be repeated
|
|
65
|
+
* If a request fails (for example, because ER is down),
|
|
66
|
+
* what is the max number of times the request should be repeated.
|
|
67
|
+
* @default -1
|
|
64
68
|
*/
|
|
65
69
|
repeatFailedRequestCount?: number;
|
|
66
70
|
/**
|
|
67
|
-
*
|
|
71
|
+
* If true, additional info about errors etc. will be printed to console.
|
|
68
72
|
*/
|
|
69
73
|
verboseOutput?: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* print which urls are used as the hosts
|
|
72
|
-
*/
|
|
73
|
-
printHostInfo?: boolean;
|
|
74
74
|
settingsFName?: string;
|
|
75
75
|
allowUseOfArchive?: boolean;
|
|
76
76
|
}
|
|
@@ -439,7 +439,7 @@ export declare namespace ER {
|
|
|
439
439
|
categories?: Weight<CategoryWeight>[];
|
|
440
440
|
locations?: Weight<LocationWeight>[];
|
|
441
441
|
langs?: string[];
|
|
442
|
-
dataType?:
|
|
442
|
+
dataType?: ("news" | "pr" | "blog")[];
|
|
443
443
|
owner?: {
|
|
444
444
|
uri: string;
|
|
445
445
|
};
|
|
@@ -595,7 +595,7 @@ export declare namespace ER {
|
|
|
595
595
|
* What details should be included in the returned information
|
|
596
596
|
*/
|
|
597
597
|
returnInfo?: ReturnInfo;
|
|
598
|
-
[name: string]: (string | number | boolean | ReturnInfo) | (string | number | boolean)[];
|
|
598
|
+
[name: string]: (string | number | boolean | ReturnInfo) | (string | number | boolean)[] | undefined;
|
|
599
599
|
}
|
|
600
600
|
export interface TopicPageEvents {
|
|
601
601
|
/**
|
|
@@ -618,7 +618,7 @@ export declare namespace ER {
|
|
|
618
618
|
* What details should be included in the returned information
|
|
619
619
|
*/
|
|
620
620
|
returnInfo?: ReturnInfo;
|
|
621
|
-
[name: string]: (string | number | boolean | ReturnInfo) | (string | number | boolean)[];
|
|
621
|
+
[name: string]: (string | number | boolean | ReturnInfo) | (string | number | boolean)[] | undefined;
|
|
622
622
|
}
|
|
623
623
|
export namespace Correlations {
|
|
624
624
|
interface TopConceptArguments {
|
|
@@ -986,6 +986,18 @@ export declare namespace ER {
|
|
|
986
986
|
articlesSampleSize?: number;
|
|
987
987
|
returnInfo?: ReturnInfo;
|
|
988
988
|
}
|
|
989
|
+
export interface RequestArticlesRecentActivityParameters {
|
|
990
|
+
maxArticleCount?: number;
|
|
991
|
+
updatesAfterNewsUri?: string;
|
|
992
|
+
updatesafterBlogUri?: string;
|
|
993
|
+
updatesAfterPrUri?: string;
|
|
994
|
+
updatesAfterTm?: string | Date;
|
|
995
|
+
updatesAfterMinsAgo?: number;
|
|
996
|
+
updatesUntilTm?: string | Date;
|
|
997
|
+
updatesUntilMinsAgo?: number;
|
|
998
|
+
mandatorySourceLocation?: boolean;
|
|
999
|
+
returnInfo?: ReturnInfo;
|
|
1000
|
+
}
|
|
989
1001
|
export namespace Aggr {
|
|
990
1002
|
namespace Source {
|
|
991
1003
|
interface CountsPerSource {
|
|
@@ -1143,9 +1155,27 @@ export declare namespace ER {
|
|
|
1143
1155
|
* "keepAll" (no filtering, default)
|
|
1144
1156
|
*/
|
|
1145
1157
|
eventFilter?: "skipArticlesWithoutEvent" | "keepOnlyArticlesWithoutEvent" | "keepAll";
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1158
|
+
/**
|
|
1159
|
+
* Some articles have an extracted author and some don't. What should be done with them. Possible values are:
|
|
1160
|
+
* "skipIfHasAuthors" (skip articles for which we have identified the author)
|
|
1161
|
+
* "keepOnlyIfHasAuthors" (return only articles for which we have extracted the author)
|
|
1162
|
+
* "keepAll" (no filtering, default)
|
|
1163
|
+
*/
|
|
1164
|
+
authorsFilter?: "skipIfHasAuthors" | "keepOnlyIfHasAuthors" | "keepAll";
|
|
1165
|
+
/**
|
|
1166
|
+
* Some articles contain a link to a video and some don't. What should be done with them. Possible values are:
|
|
1167
|
+
* "skipIfHasVideos" (skip articles that contain a link to a video)
|
|
1168
|
+
* "keepOnlyIfHasVideos" (return only articles that contain a link to a video)
|
|
1169
|
+
* "keepAll" (no filtering, default)
|
|
1170
|
+
*/
|
|
1171
|
+
videosFilter?: "skipIfHasVideos" | "keepOnlyIfHasVideos" | "keepAll";
|
|
1172
|
+
/**
|
|
1173
|
+
* Some articles contain links to other URLs and some don't. What should be done with them. Possible values are:
|
|
1174
|
+
* "skipIfHasLinks" (skip articles that contain one or more links)
|
|
1175
|
+
* "keepOnlyIfHasLinks" (return only articles that contain a link to other URLs)
|
|
1176
|
+
* "keepAll" (no filtering, default)
|
|
1177
|
+
*/
|
|
1178
|
+
linksFilter?: "skipIfHasLinks" | "keepOnlyIfHasLinks" | "keepAll";
|
|
1149
1179
|
/**
|
|
1150
1180
|
* Starting percentile of the sources to consider in the results (default: 0). Value should be in range 0-90 and divisible by 10.
|
|
1151
1181
|
*/
|
|
@@ -1172,6 +1202,24 @@ export declare namespace ER {
|
|
|
1172
1202
|
*/
|
|
1173
1203
|
requestedResult?: RequestArticles;
|
|
1174
1204
|
}
|
|
1205
|
+
interface IteratorArguments extends Arguments {
|
|
1206
|
+
/**
|
|
1207
|
+
* how should the resulting articles be sorted. Options: "rel" (relevance), "date" (published date), "sourceImportance", "sourceImportanceRank", "sourceAlexaGlobalRank", "sourceAlexaCountryRank", "socialScore", "facebookShares"
|
|
1208
|
+
*/
|
|
1209
|
+
sortBy?: string;
|
|
1210
|
+
/**
|
|
1211
|
+
* should the results be sorted in ascending order (true) or descending (false)
|
|
1212
|
+
*/
|
|
1213
|
+
sortByAsc?: boolean;
|
|
1214
|
+
/**
|
|
1215
|
+
* what details should be included in the returned information
|
|
1216
|
+
*/
|
|
1217
|
+
returnInfo?: ReturnInfo;
|
|
1218
|
+
/**
|
|
1219
|
+
* maximum number of items to be returned. Used to stop iteration sooner than results run out
|
|
1220
|
+
*/
|
|
1221
|
+
maxItems?: number;
|
|
1222
|
+
}
|
|
1175
1223
|
}
|
|
1176
1224
|
export namespace QueryEvent {
|
|
1177
1225
|
/**
|
|
@@ -1187,8 +1235,7 @@ export declare namespace ER {
|
|
|
1187
1235
|
* - facebookShares (shares on Facebook only)
|
|
1188
1236
|
*/
|
|
1189
1237
|
type SortByOptions = "id" | "date" | "cosSim" | "sourceImportance" | "sourceImportanceRank" | "sourceAlexaGlobalRank" | "sourceAlexaCountryRank" | "socialScore" | "facebookShares";
|
|
1190
|
-
|
|
1191
|
-
}
|
|
1238
|
+
type RequestEvent = Record<string, never>;
|
|
1192
1239
|
interface IteratorArguments {
|
|
1193
1240
|
/**
|
|
1194
1241
|
* Array or a single language in which to return the list of matching articles
|
|
@@ -1320,10 +1367,10 @@ export declare namespace ER {
|
|
|
1320
1367
|
/**
|
|
1321
1368
|
* array of concepts and their importance, e.g. [{ "uri": "http://en.wikipedia.org/wiki/Barack_Obama", "wgt": 100 }, ...]
|
|
1322
1369
|
*/
|
|
1323
|
-
conceptInfoList?:
|
|
1370
|
+
conceptInfoList?: {
|
|
1324
1371
|
uri: string;
|
|
1325
1372
|
wgt: number;
|
|
1326
|
-
}
|
|
1373
|
+
}[];
|
|
1327
1374
|
/**
|
|
1328
1375
|
* number of similar events to return (at most 50)
|
|
1329
1376
|
*/
|
|
@@ -1351,10 +1398,10 @@ export declare namespace ER {
|
|
|
1351
1398
|
/**
|
|
1352
1399
|
* array of concepts and their importance, e.g. [{ "uri": "http://en.wikipedia.org/wiki/Barack_Obama", "wgt": 100 }, ...]
|
|
1353
1400
|
*/
|
|
1354
|
-
conceptInfoList?:
|
|
1401
|
+
conceptInfoList?: {
|
|
1355
1402
|
uri: string;
|
|
1356
1403
|
wgt: number;
|
|
1357
|
-
}
|
|
1404
|
+
}[];
|
|
1358
1405
|
/**
|
|
1359
1406
|
* number of similar stories to return (at most 5')
|
|
1360
1407
|
*/
|
|
@@ -1413,7 +1460,44 @@ export declare namespace ER {
|
|
|
1413
1460
|
requestedResult?: RequestMentions;
|
|
1414
1461
|
}
|
|
1415
1462
|
interface IteratorArguments extends Arguments {
|
|
1416
|
-
|
|
1463
|
+
/**
|
|
1464
|
+
* how should the resulting mentions be sorted. Options: "none", "rel" (relevance), "date" (published date), "size", "socialScore"
|
|
1465
|
+
*/
|
|
1466
|
+
sortBy?: "none" | "rel" | "date" | "size" | "socialScore";
|
|
1467
|
+
/**
|
|
1468
|
+
* should the results be sorted in ascending order (true) or descending (false)
|
|
1469
|
+
*/
|
|
1470
|
+
sortByAsc?: boolean;
|
|
1471
|
+
/**
|
|
1472
|
+
* what details should be included in the returned information
|
|
1473
|
+
*/
|
|
1474
|
+
returnInfo?: ReturnInfo;
|
|
1475
|
+
/**
|
|
1476
|
+
* maximum number of items to be returned. Used to stop iteration sooner than results run out
|
|
1477
|
+
*/
|
|
1478
|
+
maxItems?: number;
|
|
1479
|
+
}
|
|
1480
|
+
interface RequestMentionsInfoArguments {
|
|
1481
|
+
/**
|
|
1482
|
+
* page of the results to return (1, 2, ...)
|
|
1483
|
+
*/
|
|
1484
|
+
page?: number;
|
|
1485
|
+
/**
|
|
1486
|
+
* number of results to return per page
|
|
1487
|
+
*/
|
|
1488
|
+
count?: number;
|
|
1489
|
+
/**
|
|
1490
|
+
* how mentions should be sorted
|
|
1491
|
+
*/
|
|
1492
|
+
sortBy?: "none" | "rel" | "date" | "size" | "socialScore";
|
|
1493
|
+
/**
|
|
1494
|
+
* should the results be sorted in ascending order (true) or descending (false)
|
|
1495
|
+
*/
|
|
1496
|
+
sortByAsc?: boolean;
|
|
1497
|
+
/**
|
|
1498
|
+
* what details should be included in the returned information
|
|
1499
|
+
*/
|
|
1500
|
+
returnInfo?: ReturnInfo;
|
|
1417
1501
|
}
|
|
1418
1502
|
interface RequestMentionsUriWgtListArguments {
|
|
1419
1503
|
/**
|
|
@@ -1937,6 +2021,24 @@ export declare namespace ER {
|
|
|
1937
2021
|
*/
|
|
1938
2022
|
returnInfo?: ReturnInfo;
|
|
1939
2023
|
}
|
|
2024
|
+
interface RequestEventsBreakingEventsArguments {
|
|
2025
|
+
/**
|
|
2026
|
+
* page of the results to return (1, 2, ...)
|
|
2027
|
+
*/
|
|
2028
|
+
page?: number;
|
|
2029
|
+
/**
|
|
2030
|
+
* max events to return (at most 50)
|
|
2031
|
+
*/
|
|
2032
|
+
count?: number;
|
|
2033
|
+
/**
|
|
2034
|
+
* the minimum score of "breakingness" of the events to be returned
|
|
2035
|
+
*/
|
|
2036
|
+
minBreakingScore?: number;
|
|
2037
|
+
/**
|
|
2038
|
+
* what details should be included in the returned information
|
|
2039
|
+
*/
|
|
2040
|
+
returnInfo?: ReturnInfo;
|
|
2041
|
+
}
|
|
1940
2042
|
}
|
|
1941
2043
|
export namespace ReturnInfo {
|
|
1942
2044
|
/**
|
|
@@ -2019,7 +2121,7 @@ export declare namespace ER {
|
|
|
2019
2121
|
* uri of the story (cluster) to which the article belongs
|
|
2020
2122
|
*/
|
|
2021
2123
|
storyUri?: boolean;
|
|
2022
|
-
[name: string]: boolean | string | number;
|
|
2124
|
+
[name: string]: boolean | string | number | undefined;
|
|
2023
2125
|
}
|
|
2024
2126
|
/**
|
|
2025
2127
|
* What information about an article should be returned by the API call
|
|
@@ -2203,7 +2305,7 @@ export declare namespace ER {
|
|
|
2203
2305
|
* number of images to be returned for a story
|
|
2204
2306
|
*/
|
|
2205
2307
|
imageCount?: number;
|
|
2206
|
-
[name: string]: boolean | string | number;
|
|
2308
|
+
[name: string]: boolean | string | number | undefined;
|
|
2207
2309
|
}
|
|
2208
2310
|
/**
|
|
2209
2311
|
* What information about an event should be returned by the API call
|
|
@@ -2302,7 +2404,7 @@ export declare namespace ER {
|
|
|
2302
2404
|
* number of images to be returned for an event
|
|
2303
2405
|
*/
|
|
2304
2406
|
imageCount?: number;
|
|
2305
|
-
[name: string]: boolean | string | number;
|
|
2407
|
+
[name: string]: boolean | string | number | undefined;
|
|
2306
2408
|
}
|
|
2307
2409
|
/**
|
|
2308
2410
|
* What information about a news source should be returned by the API call
|
|
@@ -2369,7 +2471,7 @@ export declare namespace ER {
|
|
|
2369
2471
|
* info about the names of the source groups to which the source belongs to
|
|
2370
2472
|
*/
|
|
2371
2473
|
sourceGroups?: boolean;
|
|
2372
|
-
[name: string]: boolean | string | number;
|
|
2474
|
+
[name: string]: boolean | string | number | undefined;
|
|
2373
2475
|
}
|
|
2374
2476
|
/**
|
|
2375
2477
|
* What information about a category should be returned by the API call
|
|
@@ -2382,7 +2484,7 @@ export declare namespace ER {
|
|
|
2382
2484
|
*/
|
|
2383
2485
|
interface CategoryInfo {
|
|
2384
2486
|
trendingScore?: boolean;
|
|
2385
|
-
[name: string]: boolean | string | number;
|
|
2487
|
+
[name: string]: boolean | string | number | undefined;
|
|
2386
2488
|
}
|
|
2387
2489
|
interface ConceptInfoFlags {
|
|
2388
2490
|
ConceptType?: ConceptType;
|
|
@@ -2403,7 +2505,7 @@ export declare namespace ER {
|
|
|
2403
2505
|
description?: boolean;
|
|
2404
2506
|
trendingScore?: boolean;
|
|
2405
2507
|
maxConceptsPerType?: number;
|
|
2406
|
-
[name: string]: boolean | string | number | (boolean | string | number)[];
|
|
2508
|
+
[name: string]: boolean | string | number | (boolean | string | number)[] | undefined;
|
|
2407
2509
|
}
|
|
2408
2510
|
interface LocationInfoFlags {
|
|
2409
2511
|
label?: boolean;
|
|
@@ -2428,7 +2530,7 @@ export declare namespace ER {
|
|
|
2428
2530
|
countryContinent?: boolean;
|
|
2429
2531
|
placeFeatureCode?: boolean;
|
|
2430
2532
|
placeCountry?: boolean;
|
|
2431
|
-
[name: string]: boolean | string | number;
|
|
2533
|
+
[name: string]: boolean | string | number | undefined;
|
|
2432
2534
|
}
|
|
2433
2535
|
interface ConceptClassInfoFlags {
|
|
2434
2536
|
IncludeConceptClassParentLabels?: boolean;
|
|
@@ -2437,7 +2539,7 @@ export declare namespace ER {
|
|
|
2437
2539
|
interface ConceptClassInfo {
|
|
2438
2540
|
parentLabels?: boolean;
|
|
2439
2541
|
concepts?: boolean;
|
|
2440
|
-
[name: string]: boolean | string | number;
|
|
2542
|
+
[name: string]: boolean | string | number | undefined;
|
|
2441
2543
|
}
|
|
2442
2544
|
interface ConceptFolderInfoFlags {
|
|
2443
2545
|
IncludeConceptFolderDefinition?: boolean;
|
|
@@ -2446,7 +2548,7 @@ export declare namespace ER {
|
|
|
2446
2548
|
interface ConceptFolderInfo {
|
|
2447
2549
|
definition?: boolean;
|
|
2448
2550
|
owner?: boolean;
|
|
2449
|
-
[name: string]: boolean | string | number;
|
|
2551
|
+
[name: string]: boolean | string | number | undefined;
|
|
2450
2552
|
}
|
|
2451
2553
|
}
|
|
2452
2554
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const __version__ = "10.0.0";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { EventRegistry } from "./eventRegistry";
|
|
2
|
+
import { ER } from "./types";
|
|
3
|
+
export declare class Analytics {
|
|
4
|
+
private er;
|
|
5
|
+
/**
|
|
6
|
+
* @param eventRegistry: instance of EventRegistry class
|
|
7
|
+
*/
|
|
8
|
+
constructor(er: EventRegistry);
|
|
9
|
+
/**
|
|
10
|
+
* Identify the list of entities and nonentities mentioned in the text
|
|
11
|
+
* @param text input text to annotate
|
|
12
|
+
* @param lang language of the provided document (can be an ISO2 or ISO3 code). If None is provided, the language will be automatically detected
|
|
13
|
+
*/
|
|
14
|
+
annotate(text: string, lang?: string[], customParams?: {
|
|
15
|
+
[name: string]: unknown;
|
|
16
|
+
}): Promise<ER.Analytics.Response.Annotate>;
|
|
17
|
+
/**
|
|
18
|
+
* Determine the set of up to 5 categories the text is about. Currently, only English text can be categorized!
|
|
19
|
+
* @param text input text to categorize
|
|
20
|
+
* @param taxonomy: which taxonomy use for categorization. Options:
|
|
21
|
+
* - "dmoz" (over 5000 categories in 3 levels, English language only)
|
|
22
|
+
* - "news" (general news categorization, 9 categories, any langauge)
|
|
23
|
+
* @param concepts optional list of concept URIs to bias categorization
|
|
24
|
+
*/
|
|
25
|
+
categorize(text: string, taxonomy?: "dmoz" | "news", concepts?: string[]): Promise<ER.Analytics.Response.Categorize>;
|
|
26
|
+
/**
|
|
27
|
+
* determine the sentiment of the provided text in English language
|
|
28
|
+
* @param text input text to categorize
|
|
29
|
+
* @param method method to use to compute the sentiment. possible values are "vocabulary" (vocabulary based sentiment analysis) and "rnn" (neural network based sentiment classification)
|
|
30
|
+
*/
|
|
31
|
+
sentiment(text: string, method?: string, sentences?: number, returnSentences?: boolean): Promise<ER.Analytics.Response.Sentiment>;
|
|
32
|
+
semanticSimilarity(text1: string, text2: string, distanceMeasure?: "cosine" | "jaccard"): Promise<ER.Analytics.Response.SentimentSimilarity>;
|
|
33
|
+
/**
|
|
34
|
+
* Determine the language of the given text
|
|
35
|
+
* @param text input text to analyse
|
|
36
|
+
*/
|
|
37
|
+
detectLanguage(text: string): Promise<ER.Analytics.Response.DetectLanguage>;
|
|
38
|
+
/**
|
|
39
|
+
* Extract all available information about an article available at url `url`.
|
|
40
|
+
* Returned information will include article title, body, authors, links in the articles,...
|
|
41
|
+
* @param url article url that'll be used for extraction
|
|
42
|
+
* @param proxyUrl proxy that should be used for downloading article information. format: {schema}://{username}:{pass}@{proxy url/ip}
|
|
43
|
+
*/
|
|
44
|
+
extractArticleInfo(url: string, proxyUrl?: string, headers?: {
|
|
45
|
+
[name: string]: unknown;
|
|
46
|
+
}, cookies?: {
|
|
47
|
+
[name: string]: unknown;
|
|
48
|
+
}): Promise<ER.Analytics.Response.ExtractArticleInfo>;
|
|
49
|
+
/**
|
|
50
|
+
* Extract named entities from the provided text. Supported languages are English, German, Spanish and Chinese.
|
|
51
|
+
* @param text: text on which to extract named entities
|
|
52
|
+
*/
|
|
53
|
+
ner(text: string): Promise<unknown>;
|
|
54
|
+
/**
|
|
55
|
+
* Create a new topic and train it using the tweets that match the twitterQuery
|
|
56
|
+
* @param twitterQuery string containing the content to search for. It can be a Twitter user account (using "@" prefix or user's Twitter url),a hash tag (using "#" prefix) or a regular keyword.
|
|
57
|
+
* @param args Object which contains a host of optional parameters
|
|
58
|
+
*/
|
|
59
|
+
trainTopicOnTweets(twitterQuery: string, args?: ER.Analytics.TrainTopicOnTweetsArguments): Promise<ER.Analytics.Response>;
|
|
60
|
+
/**
|
|
61
|
+
* Create a new topic to train. The user should remember the "uri" parameter returned in the result.
|
|
62
|
+
* @param name name of the topic we want to create
|
|
63
|
+
* @returns object containing the "uri" property that should be used in the follow-up call to trainTopic* methods
|
|
64
|
+
*/
|
|
65
|
+
trainTopicCreateTopic(name: string): Promise<ER.Analytics.Response>;
|
|
66
|
+
/**
|
|
67
|
+
* If the topic is already existing, clear the definition of the topic. Use this if you want to retrain an existing topic
|
|
68
|
+
* @param uri uri of the topic (obtained by calling trainTopicCreateTopic method) to clear
|
|
69
|
+
*/
|
|
70
|
+
trainTopicClearTopic(uri: string): Promise<ER.Analytics.Response>;
|
|
71
|
+
/**
|
|
72
|
+
* Add the information extracted from the provided "text" to the topic with uri "uri".
|
|
73
|
+
* @param uri uri of the topic (obtained by calling trainTopicCreateTopic method)
|
|
74
|
+
* @param text text to analyze and extract information from
|
|
75
|
+
*/
|
|
76
|
+
trainTopicAddDocument(uri: string, text: string): Promise<ER.Analytics.Response>;
|
|
77
|
+
/**
|
|
78
|
+
* Retrieve topic for the topic for which you have already finished training
|
|
79
|
+
* @param uri uri of the topic (obtained by calling trainTopicCreateTopic method)
|
|
80
|
+
* @returns returns the trained topic: { concepts: [], categories: [] }
|
|
81
|
+
*/
|
|
82
|
+
trainTopicGetTrainedTopic(uri: string, args?: ER.Analytics.TrainTopicGetTrainedTopicArguments): Promise<ER.Analytics.Response>;
|
|
83
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// The Analytics class can be used for access the text analytics services provided by the Event Registry.
|
|
2
|
+
// These include:
|
|
3
|
+
// - text annotation: identifying the list of entities and non-entities mentioned in the provided text
|
|
4
|
+
// - text categorization: identification of up to 5 categories that describe the topic of the given text.
|
|
5
|
+
// The list of available categories come from DMOZ open directory. Currently, only English text can be categorized!
|
|
6
|
+
// - sentiment detection: what is the sentiment expressed in the given text
|
|
7
|
+
// - language detection: detect in which language is the given text written
|
|
8
|
+
// NOTE: the functionality is currently in BETA. The API calls or the provided outputs may change in the future.
|
|
9
|
+
export class Analytics {
|
|
10
|
+
/**
|
|
11
|
+
* @param eventRegistry: instance of EventRegistry class
|
|
12
|
+
*/
|
|
13
|
+
constructor(er) {
|
|
14
|
+
this.er = er;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Identify the list of entities and nonentities mentioned in the text
|
|
18
|
+
* @param text input text to annotate
|
|
19
|
+
* @param lang language of the provided document (can be an ISO2 or ISO3 code). If None is provided, the language will be automatically detected
|
|
20
|
+
*/
|
|
21
|
+
async annotate(text, lang, customParams) {
|
|
22
|
+
let params = { lang, text };
|
|
23
|
+
if (!!customParams) {
|
|
24
|
+
params = { ...params, ...customParams };
|
|
25
|
+
}
|
|
26
|
+
const response = await this.er.jsonRequestAnalytics("/api/v1/annotate", params);
|
|
27
|
+
return response?.data;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Determine the set of up to 5 categories the text is about. Currently, only English text can be categorized!
|
|
31
|
+
* @param text input text to categorize
|
|
32
|
+
* @param taxonomy: which taxonomy use for categorization. Options:
|
|
33
|
+
* - "dmoz" (over 5000 categories in 3 levels, English language only)
|
|
34
|
+
* - "news" (general news categorization, 9 categories, any langauge)
|
|
35
|
+
* @param concepts optional list of concept URIs to bias categorization
|
|
36
|
+
*/
|
|
37
|
+
async categorize(text, taxonomy = "dmoz", concepts) {
|
|
38
|
+
const params = { text, taxonomy };
|
|
39
|
+
if (Array.isArray(concepts) && concepts.length > 0) {
|
|
40
|
+
params.concepts = concepts;
|
|
41
|
+
}
|
|
42
|
+
const response = await this.er.jsonRequestAnalytics("/api/v1/categorize", params);
|
|
43
|
+
return response?.data;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* determine the sentiment of the provided text in English language
|
|
47
|
+
* @param text input text to categorize
|
|
48
|
+
* @param method method to use to compute the sentiment. possible values are "vocabulary" (vocabulary based sentiment analysis) and "rnn" (neural network based sentiment classification)
|
|
49
|
+
*/
|
|
50
|
+
async sentiment(text, method = "vocabulary", sentences = 10, returnSentences = true) {
|
|
51
|
+
if (!["vocabulary", "rnn"].includes(method)) {
|
|
52
|
+
throw new Error("method: Please pass in either 'vocabulary' or 'rnn'");
|
|
53
|
+
}
|
|
54
|
+
const params = {
|
|
55
|
+
text,
|
|
56
|
+
method,
|
|
57
|
+
sentences,
|
|
58
|
+
returnSentences
|
|
59
|
+
};
|
|
60
|
+
const response = await this.er.jsonRequestAnalytics("/api/v1/sentiment", params);
|
|
61
|
+
return response?.data;
|
|
62
|
+
}
|
|
63
|
+
async semanticSimilarity(text1, text2, distanceMeasure = "cosine") {
|
|
64
|
+
const response = await this.er.jsonRequestAnalytics("/api/v1/semanticSimilarity", { text1, text2, distanceMeasure });
|
|
65
|
+
return response?.data;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Determine the language of the given text
|
|
69
|
+
* @param text input text to analyse
|
|
70
|
+
*/
|
|
71
|
+
async detectLanguage(text) {
|
|
72
|
+
const response = await this.er.jsonRequestAnalytics("/api/v1/detectLanguage", { text });
|
|
73
|
+
return response?.data;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Extract all available information about an article available at url `url`.
|
|
77
|
+
* Returned information will include article title, body, authors, links in the articles,...
|
|
78
|
+
* @param url article url that'll be used for extraction
|
|
79
|
+
* @param proxyUrl proxy that should be used for downloading article information. format: {schema}://{username}:{pass}@{proxy url/ip}
|
|
80
|
+
*/
|
|
81
|
+
async extractArticleInfo(url, proxyUrl, headers, cookies) {
|
|
82
|
+
const params = { url };
|
|
83
|
+
if (!!proxyUrl) {
|
|
84
|
+
params.proxyUrl = proxyUrl;
|
|
85
|
+
}
|
|
86
|
+
const response = await this.er.jsonRequestAnalytics("/api/v1/extractArticleInfo", params, headers, cookies);
|
|
87
|
+
return response?.data;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Extract named entities from the provided text. Supported languages are English, German, Spanish and Chinese.
|
|
91
|
+
* @param text: text on which to extract named entities
|
|
92
|
+
*/
|
|
93
|
+
async ner(text) {
|
|
94
|
+
const response = await this.er.jsonRequestAnalytics("/api/v1/ner", { text });
|
|
95
|
+
return response?.data;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Create a new topic and train it using the tweets that match the twitterQuery
|
|
99
|
+
* @param twitterQuery string containing the content to search for. It can be a Twitter user account (using "@" prefix or user's Twitter url),a hash tag (using "#" prefix) or a regular keyword.
|
|
100
|
+
* @param args Object which contains a host of optional parameters
|
|
101
|
+
*/
|
|
102
|
+
async trainTopicOnTweets(twitterQuery, args = {}) {
|
|
103
|
+
const { useTweetText = true, useIdfNormalization = true, normalization = "linear", maxTweets = 2000, maxUsedLinks = 500, ignoreConceptTypes = [], maxConcepts = 20, maxCategories = 10, notifyEmailAddress = undefined } = args;
|
|
104
|
+
if (maxTweets > 5000) {
|
|
105
|
+
throw new Error("We can analyze at most 5000 tweets");
|
|
106
|
+
}
|
|
107
|
+
const params = {
|
|
108
|
+
twitterQuery,
|
|
109
|
+
useTweetText,
|
|
110
|
+
useIdfNormalization,
|
|
111
|
+
normalization,
|
|
112
|
+
maxTweets,
|
|
113
|
+
maxUsedLinks,
|
|
114
|
+
maxConcepts,
|
|
115
|
+
maxCategories
|
|
116
|
+
};
|
|
117
|
+
if (notifyEmailAddress) {
|
|
118
|
+
params.notifyEmailAddress = notifyEmailAddress;
|
|
119
|
+
}
|
|
120
|
+
if (ignoreConceptTypes && Object.keys(ignoreConceptTypes).length > 0) {
|
|
121
|
+
params.ignoreConceptTypes = ignoreConceptTypes;
|
|
122
|
+
}
|
|
123
|
+
const response = await this.er.jsonRequestAnalytics("/api/v1/trainTopicOnTwitter", params);
|
|
124
|
+
return response?.data;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Create a new topic to train. The user should remember the "uri" parameter returned in the result.
|
|
128
|
+
* @param name name of the topic we want to create
|
|
129
|
+
* @returns object containing the "uri" property that should be used in the follow-up call to trainTopic* methods
|
|
130
|
+
*/
|
|
131
|
+
async trainTopicCreateTopic(name) {
|
|
132
|
+
const response = await this.er.jsonRequestAnalytics("/api/v1/trainTopic", { action: "createTopic", name });
|
|
133
|
+
return response?.data;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* If the topic is already existing, clear the definition of the topic. Use this if you want to retrain an existing topic
|
|
137
|
+
* @param uri uri of the topic (obtained by calling trainTopicCreateTopic method) to clear
|
|
138
|
+
*/
|
|
139
|
+
async trainTopicClearTopic(uri) {
|
|
140
|
+
const response = await this.er.jsonRequestAnalytics("/api/v1/trainTopic", { action: "clearTopic", uri });
|
|
141
|
+
return response?.data;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Add the information extracted from the provided "text" to the topic with uri "uri".
|
|
145
|
+
* @param uri uri of the topic (obtained by calling trainTopicCreateTopic method)
|
|
146
|
+
* @param text text to analyze and extract information from
|
|
147
|
+
*/
|
|
148
|
+
async trainTopicAddDocument(uri, text) {
|
|
149
|
+
const response = await this.er.jsonRequestAnalytics("/api/v1/trainTopic", { action: "addDocument", uri, text });
|
|
150
|
+
return response?.data;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Retrieve topic for the topic for which you have already finished training
|
|
154
|
+
* @param uri uri of the topic (obtained by calling trainTopicCreateTopic method)
|
|
155
|
+
* @returns returns the trained topic: { concepts: [], categories: [] }
|
|
156
|
+
*/
|
|
157
|
+
async trainTopicGetTrainedTopic(uri, args = {}) {
|
|
158
|
+
const { maxConcepts = 20, maxCategories = 10, idfNormalization = true } = args;
|
|
159
|
+
const params = {
|
|
160
|
+
action: "getTrainedTopic",
|
|
161
|
+
uri: uri,
|
|
162
|
+
maxConcepts: maxConcepts,
|
|
163
|
+
maxCategories: maxCategories,
|
|
164
|
+
idfNormalization: idfNormalization
|
|
165
|
+
};
|
|
166
|
+
const response = await this.er.jsonRequestAnalytics("/api/v1/trainTopic", params);
|
|
167
|
+
return response?.data;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=analytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/analytics.ts"],"names":[],"mappings":"AAGA,yGAAyG;AACzG,iBAAiB;AACjB,sGAAsG;AACtG,yGAAyG;AACzG,uHAAuH;AACvH,2EAA2E;AAC3E,2EAA2E;AAE3E,gHAAgH;AAEhH,MAAM,OAAO,SAAS;IAClB;;OAEG;IACH,YAAoB,EAAiB;QAAjB,OAAE,GAAF,EAAE,CAAe;IAAI,CAAC;IAE1C;;;;OAIG;IACI,KAAK,CAAC,QAAQ,CAAC,IAAY,EAAE,IAAe,EAAE,YAAwC;QACzF,IAAI,MAAM,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;YACjB,MAAM,GAAG,EAAC,GAAG,MAAM,EAAE,GAAG,YAAY,EAAC,CAAC;QAC1C,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,oBAAoB,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QAChF,OAAO,QAAQ,EAAE,IAAsC,CAAC;IAC5D,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,UAAU,CAAC,IAAY,EAAE,WAA4B,MAAM,EAAE,QAAmB;QACzF,MAAM,MAAM,GAAqE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QACpG,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjD,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC/B,CAAC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