@aws-amplify/predictions 4.0.62-unstable.2 → 4.0.62
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 +16 -0
- package/build.js +5 -0
- package/dist/aws-amplify-predictions.js +101211 -0
- package/dist/aws-amplify-predictions.js.map +1 -0
- package/dist/aws-amplify-predictions.min.js +26 -0
- package/dist/aws-amplify-predictions.min.js.map +1 -0
- package/index.js +7 -0
- package/lib/Predictions.js +34 -4
- package/lib/Predictions.js.map +1 -1
- package/lib/Providers/AmazonAIConvertPredictionsProvider.js +62 -10
- package/lib/Providers/AmazonAIConvertPredictionsProvider.js.map +1 -1
- package/lib/Providers/AmazonAIIdentifyPredictionsProvider.js +84 -18
- package/lib/Providers/AmazonAIIdentifyPredictionsProvider.js.map +1 -1
- package/lib/Providers/AmazonAIInterpretPredictionsProvider.js +83 -15
- package/lib/Providers/AmazonAIInterpretPredictionsProvider.js.map +1 -1
- package/lib/Providers/AmazonAIPredictionsProvider.js +18 -2
- package/lib/Providers/AmazonAIPredictionsProvider.js.map +1 -1
- package/lib/Providers/IdentifyTextUtils.js +17 -7
- package/lib/Providers/IdentifyTextUtils.js.map +1 -1
- package/lib/index.js +20 -4
- package/lib/index.js.map +1 -1
- package/lib/types/Providers/AbstractConvertPredictionsProvider.js +14 -2
- package/lib/types/Providers/AbstractConvertPredictionsProvider.js.map +1 -1
- package/lib/types/Providers/AbstractIdentifyPredictionsProvider.js +14 -2
- package/lib/types/Providers/AbstractIdentifyPredictionsProvider.js.map +1 -1
- package/lib/types/Providers/AbstractInterpretPredictionsProvider.js +14 -2
- package/lib/types/Providers/AbstractInterpretPredictionsProvider.js.map +1 -1
- package/lib/types/Providers/index.js +7 -5
- package/lib/types/Providers/index.js.map +1 -1
- package/lib/types/index.js +4 -2
- package/lib/types/index.js.map +1 -1
- package/lib-esm/Predictions.js +31 -1
- package/lib-esm/Predictions.js.map +1 -1
- package/lib-esm/Providers/AmazonAIConvertPredictionsProvider.d.ts +4 -0
- package/lib-esm/Providers/AmazonAIConvertPredictionsProvider.js +53 -1
- package/lib-esm/Providers/AmazonAIConvertPredictionsProvider.js.map +1 -1
- package/lib-esm/Providers/AmazonAIIdentifyPredictionsProvider.d.ts +4 -0
- package/lib-esm/Providers/AmazonAIIdentifyPredictionsProvider.js +66 -3
- package/lib-esm/Providers/AmazonAIIdentifyPredictionsProvider.js.map +1 -1
- package/lib-esm/Providers/AmazonAIInterpretPredictionsProvider.d.ts +4 -0
- package/lib-esm/Providers/AmazonAIInterpretPredictionsProvider.js +69 -1
- package/lib-esm/Providers/AmazonAIInterpretPredictionsProvider.js.map +1 -1
- package/lib-esm/Providers/AmazonAIPredictionsProvider.d.ts +4 -0
- package/lib-esm/Providers/AmazonAIPredictionsProvider.js +17 -1
- package/lib-esm/Providers/AmazonAIPredictionsProvider.js.map +1 -1
- package/lib-esm/Providers/IdentifyTextUtils.js +11 -1
- package/lib-esm/Providers/IdentifyTextUtils.js.map +1 -1
- package/lib-esm/index.d.ts +4 -0
- package/lib-esm/index.js +16 -2
- package/lib-esm/index.js.map +1 -1
- package/lib-esm/types/Providers/AbstractConvertPredictionsProvider.js +13 -1
- package/lib-esm/types/Providers/AbstractConvertPredictionsProvider.js.map +1 -1
- package/lib-esm/types/Providers/AbstractIdentifyPredictionsProvider.js +13 -1
- package/lib-esm/types/Providers/AbstractIdentifyPredictionsProvider.js.map +1 -1
- package/lib-esm/types/Providers/AbstractInterpretPredictionsProvider.js +13 -1
- package/lib-esm/types/Providers/AbstractInterpretPredictionsProvider.js.map +1 -1
- package/package.json +10 -14
- package/src/Providers/AmazonAIConvertPredictionsProvider.ts +8 -4
- package/src/Providers/AmazonAIIdentifyPredictionsProvider.ts +8 -4
- package/src/Providers/AmazonAIInterpretPredictionsProvider.ts +8 -2
- package/src/Providers/AmazonAIPredictionsProvider.ts +5 -0
- package/src/index.ts +17 -2
- package/webpack.config.dev.js +6 -0
- package/lib/.tsbuildinfo +0 -3
- package/lib/Predictions.d.ts +0 -49
- package/lib/Providers/AmazonAIConvertPredictionsProvider.d.ts +0 -20
- package/lib/Providers/AmazonAIIdentifyPredictionsProvider.d.ts +0 -49
- package/lib/Providers/AmazonAIInterpretPredictionsProvider.d.ts +0 -14
- package/lib/Providers/AmazonAIPredictionsProvider.d.ts +0 -14
- package/lib/Providers/IdentifyTextUtils.d.ts +0 -40
- package/lib/Providers/Utils.d.ts +0 -13
- package/lib/Providers/index.d.ts +0 -5
- package/lib/index.d.ts +0 -4
- package/lib/types/AWSTypes.d.ts +0 -125
- package/lib/types/Predictions.d.ts +0 -281
- package/lib/types/Providers/AbstractConvertPredictionsProvider.d.ts +0 -9
- package/lib/types/Providers/AbstractIdentifyPredictionsProvider.d.ts +0 -9
- package/lib/types/Providers/AbstractInterpretPredictionsProvider.d.ts +0 -7
- package/lib/types/Providers/AbstractPredictionsProvider.d.ts +0 -7
- package/lib/types/Providers/index.d.ts +0 -4
- package/lib/types/index.d.ts +0 -1
- package/lib-esm/.tsbuildinfo +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/predictions",
|
|
3
|
-
"version": "4.0.62
|
|
3
|
+
"version": "4.0.62",
|
|
4
4
|
"description": "Machine learning category of aws-amplify",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib-esm/index.js",
|
|
@@ -9,8 +9,11 @@
|
|
|
9
9
|
"./lib/index": "./lib-esm/index.js"
|
|
10
10
|
},
|
|
11
11
|
"sideEffects": [
|
|
12
|
+
"./src/Predictions.ts",
|
|
12
13
|
"./lib/Predictions.js",
|
|
13
|
-
"./lib-esm/Predictions.js"
|
|
14
|
+
"./lib-esm/Predictions.js",
|
|
15
|
+
"./dist/aws-amplify-predictions.min.js",
|
|
16
|
+
"./dist/aws-amplify-predictions.js"
|
|
14
17
|
],
|
|
15
18
|
"scripts": {
|
|
16
19
|
"test": "jest -w 1 --passWithNoTests --coverage --maxWorkers 2",
|
|
@@ -22,10 +25,9 @@
|
|
|
22
25
|
"build": "npm run clean && npm run build:esm && npm run build:cjs",
|
|
23
26
|
"clean": "rimraf lib-esm lib dist",
|
|
24
27
|
"format": "echo \"Not implemented\"",
|
|
25
|
-
"lint": "tslint 'src/**/*.ts'
|
|
28
|
+
"lint": "tslint 'src/**/*.ts'",
|
|
26
29
|
"generate-docs-local": "typedoc --out docs src",
|
|
27
|
-
"generate-docs-root": "typedoc --out ../../docs src"
|
|
28
|
-
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 87.84"
|
|
30
|
+
"generate-docs-root": "typedoc --out ../../docs src"
|
|
29
31
|
},
|
|
30
32
|
"repository": {
|
|
31
33
|
"type": "git",
|
|
@@ -37,14 +39,9 @@
|
|
|
37
39
|
"url": "https://github.com/aws/aws-amplify/issues"
|
|
38
40
|
},
|
|
39
41
|
"homepage": "https://aws-amplify.github.io/",
|
|
40
|
-
"files": [
|
|
41
|
-
"lib",
|
|
42
|
-
"lib-esm",
|
|
43
|
-
"src"
|
|
44
|
-
],
|
|
45
42
|
"dependencies": {
|
|
46
|
-
"@aws-amplify/core": "4.7.13
|
|
47
|
-
"@aws-amplify/storage": "4.5.15
|
|
43
|
+
"@aws-amplify/core": "4.7.13",
|
|
44
|
+
"@aws-amplify/storage": "4.5.15",
|
|
48
45
|
"@aws-sdk/client-comprehend": "3.6.1",
|
|
49
46
|
"@aws-sdk/client-polly": "3.6.1",
|
|
50
47
|
"@aws-sdk/client-rekognition": "3.6.1",
|
|
@@ -52,7 +49,6 @@
|
|
|
52
49
|
"@aws-sdk/client-translate": "3.6.1",
|
|
53
50
|
"@aws-sdk/eventstream-marshaller": "3.6.1",
|
|
54
51
|
"@aws-sdk/util-utf8-node": "3.6.1",
|
|
55
|
-
"tslib": "^1.8.0",
|
|
56
52
|
"uuid": "^3.2.1"
|
|
57
53
|
},
|
|
58
54
|
"jest": {
|
|
@@ -99,5 +95,5 @@
|
|
|
99
95
|
"lib-esm"
|
|
100
96
|
]
|
|
101
97
|
},
|
|
102
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "eaa4317115aaa23a632af7249b3d995e83af6ef3"
|
|
103
99
|
}
|
|
@@ -254,10 +254,9 @@ export class AmazonAIConvertPredictionsProvider extends AbstractConvertPredictio
|
|
|
254
254
|
let fullText = '';
|
|
255
255
|
connection.onmessage = message => {
|
|
256
256
|
try {
|
|
257
|
-
const decodedMessage =
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
);
|
|
257
|
+
const decodedMessage = AmazonAIConvertPredictionsProvider.serializeDataFromTranscribe(
|
|
258
|
+
message
|
|
259
|
+
);
|
|
261
260
|
if (decodedMessage) {
|
|
262
261
|
fullText += decodedMessage + ' ';
|
|
263
262
|
}
|
|
@@ -428,3 +427,8 @@ export class AmazonAIConvertPredictionsProvider extends AbstractConvertPredictio
|
|
|
428
427
|
return signedUrl;
|
|
429
428
|
}
|
|
430
429
|
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* @deprecated use named import
|
|
433
|
+
*/
|
|
434
|
+
export default AmazonAIConvertPredictionsProvider;
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
ConsoleLogger as Logger,
|
|
4
4
|
getAmplifyUserAgent,
|
|
5
5
|
} from '@aws-amplify/core';
|
|
6
|
-
import
|
|
6
|
+
import Storage from '@aws-amplify/storage';
|
|
7
7
|
import { AbstractIdentifyPredictionsProvider } from '../types/Providers';
|
|
8
8
|
import {
|
|
9
9
|
RekognitionClient,
|
|
@@ -80,8 +80,7 @@ export class AmazonAIIdentifyPredictionsProvider extends AbstractIdentifyPredict
|
|
|
80
80
|
};
|
|
81
81
|
Storage.get(source.key, storageConfig)
|
|
82
82
|
.then((url: string) => {
|
|
83
|
-
const parser =
|
|
84
|
-
/https:\/\/([a-zA-Z0-9%-_.]+)\.s3\.[A-Za-z0-9%-._~]+\/([a-zA-Z0-9%-._~/]+)\?/;
|
|
83
|
+
const parser = /https:\/\/([a-zA-Z0-9%-_.]+)\.s3\.[A-Za-z0-9%-._~]+\/([a-zA-Z0-9%-._~/]+)\?/;
|
|
85
84
|
const parsedURL = url.match(parser);
|
|
86
85
|
if (parsedURL.length < 3) rej('Invalid S3 key was given.');
|
|
87
86
|
res({
|
|
@@ -450,7 +449,7 @@ export class AmazonAIIdentifyPredictionsProvider extends AbstractIdentifyPredict
|
|
|
450
449
|
'Beard',
|
|
451
450
|
'Mustache',
|
|
452
451
|
'EyesOpen',
|
|
453
|
-
'MouthOpen'
|
|
452
|
+
'MouthOpen'
|
|
454
453
|
];
|
|
455
454
|
const faceAttributes = makeCamelCase(detail, attributeKeys);
|
|
456
455
|
if (detail.Emotions) {
|
|
@@ -480,3 +479,8 @@ export class AmazonAIIdentifyPredictionsProvider extends AbstractIdentifyPredict
|
|
|
480
479
|
return ('' + externalImageId).replace(/::/g, '/');
|
|
481
480
|
}
|
|
482
481
|
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* @deprecated use named import
|
|
485
|
+
*/
|
|
486
|
+
export default AmazonAIIdentifyPredictionsProvider;
|
|
@@ -45,8 +45,9 @@ export class AmazonAIInterpretPredictionsProvider extends AbstractInterpretPredi
|
|
|
45
45
|
} = {},
|
|
46
46
|
} = ({} = input);
|
|
47
47
|
|
|
48
|
-
const {
|
|
49
|
-
|
|
48
|
+
const {
|
|
49
|
+
text: { source: { language = undefined } = {} } = {},
|
|
50
|
+
} = ({} = input as any); // language is only required for specific interpret types
|
|
50
51
|
|
|
51
52
|
const comprehendClient = new ComprehendClient({
|
|
52
53
|
credentials,
|
|
@@ -283,3 +284,8 @@ export class AmazonAIInterpretPredictionsProvider extends AbstractInterpretPredi
|
|
|
283
284
|
}
|
|
284
285
|
}
|
|
285
286
|
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* @deprecated use named import
|
|
290
|
+
*/
|
|
291
|
+
export default AmazonAIInterpretPredictionsProvider;
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
5
|
+
* the License. A copy of the License is located at
|
|
6
|
+
*
|
|
7
|
+
* http://aws.amazon.com/apache2.0/
|
|
8
|
+
*
|
|
9
|
+
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
10
|
+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
11
|
+
* and limitations under the License.
|
|
12
|
+
*/
|
|
3
13
|
import { Predictions } from './Predictions';
|
|
4
14
|
|
|
5
15
|
import {
|
|
@@ -18,3 +28,8 @@ export {
|
|
|
18
28
|
AmazonAIPredictionsProvider,
|
|
19
29
|
AmazonAIInterpretPredictionsProvider,
|
|
20
30
|
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated use named import
|
|
34
|
+
*/
|
|
35
|
+
export default Predictions;
|
package/lib/.tsbuildinfo
DELETED
package/lib/Predictions.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { PredictionsOptions, TranslateTextInput, TranslateTextOutput, TextToSpeechInput, ProviderOptions, TextToSpeechOutput, SpeechToTextInput, SpeechToTextOutput, IdentifyTextInput, IdentifyTextOutput, IdentifyLabelsOutput, IdentifyLabelsInput, IdentifyEntitiesInput, IdentifyEntitiesOutput, InterpretTextOutput, InterpretTextInput } from './types';
|
|
2
|
-
import { AbstractPredictionsProvider } from './types/Providers';
|
|
3
|
-
export declare class PredictionsClass {
|
|
4
|
-
private _options;
|
|
5
|
-
private _convertPluggables;
|
|
6
|
-
private _identifyPluggables;
|
|
7
|
-
private _interpretPluggables;
|
|
8
|
-
/**
|
|
9
|
-
* Initialize Predictions with AWS configurations
|
|
10
|
-
* @param {PredictionsOptions} options - Configuration object for Predictions
|
|
11
|
-
*/
|
|
12
|
-
constructor(options: PredictionsOptions);
|
|
13
|
-
getModuleName(): string;
|
|
14
|
-
/**
|
|
15
|
-
* add plugin/pluggable into Predictions category
|
|
16
|
-
* @param {Object} pluggable - an instance of the plugin/pluggable
|
|
17
|
-
**/
|
|
18
|
-
addPluggable(pluggable: AbstractPredictionsProvider): void;
|
|
19
|
-
/**
|
|
20
|
-
* Get the plugin object
|
|
21
|
-
* @param providerName - the name of the plugin
|
|
22
|
-
*/
|
|
23
|
-
getPluggable(providerName: string): AbstractPredictionsProvider;
|
|
24
|
-
/**
|
|
25
|
-
* Remove the plugin object
|
|
26
|
-
* @param providerName - the name of the plugin
|
|
27
|
-
*/
|
|
28
|
-
removePluggable(providerName: string): void;
|
|
29
|
-
/**
|
|
30
|
-
* To make both top level providers and category level providers work with same interface and configuration
|
|
31
|
-
* this method duplicates Predictions config into parent level config (for top level provider) and
|
|
32
|
-
* category level config (such as convert, identify etc) and pass both to each provider.
|
|
33
|
-
*/
|
|
34
|
-
configure(options: PredictionsOptions): void;
|
|
35
|
-
interpret(input: InterpretTextInput, options?: ProviderOptions): Promise<InterpretTextOutput>;
|
|
36
|
-
convert(input: TranslateTextInput, options?: ProviderOptions): Promise<TranslateTextOutput>;
|
|
37
|
-
convert(input: TextToSpeechInput, options?: ProviderOptions): Promise<TextToSpeechOutput>;
|
|
38
|
-
convert(input: SpeechToTextInput, options?: ProviderOptions): Promise<SpeechToTextOutput>;
|
|
39
|
-
identify(input: IdentifyTextInput, options?: ProviderOptions): Promise<IdentifyTextOutput>;
|
|
40
|
-
identify(input: IdentifyLabelsInput, options?: ProviderOptions): Promise<IdentifyLabelsOutput>;
|
|
41
|
-
identify(input: IdentifyEntitiesInput, options?: ProviderOptions): Promise<IdentifyEntitiesOutput>;
|
|
42
|
-
private getPluggableToExecute;
|
|
43
|
-
private getAllProviders;
|
|
44
|
-
private configurePluggable;
|
|
45
|
-
private implementsConvertPluggable;
|
|
46
|
-
private implementsIdentifyPluggable;
|
|
47
|
-
private implementsInterpretPluggable;
|
|
48
|
-
}
|
|
49
|
-
export declare const Predictions: PredictionsClass;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { AbstractConvertPredictionsProvider } from '../types/Providers/AbstractConvertPredictionsProvider';
|
|
2
|
-
import { TranslateTextInput, TextToSpeechInput, SpeechToTextInput, TranslateTextOutput, TextToSpeechOutput, SpeechToTextOutput } from '../types';
|
|
3
|
-
export declare class AmazonAIConvertPredictionsProvider extends AbstractConvertPredictionsProvider {
|
|
4
|
-
private translateClient;
|
|
5
|
-
private pollyClient;
|
|
6
|
-
constructor();
|
|
7
|
-
getProviderName(): string;
|
|
8
|
-
protected translateText(input: TranslateTextInput): Promise<TranslateTextOutput>;
|
|
9
|
-
protected convertTextToSpeech(input: TextToSpeechInput): Promise<TextToSpeechOutput>;
|
|
10
|
-
protected convertSpeechToText(input: SpeechToTextInput): Promise<SpeechToTextOutput>;
|
|
11
|
-
static serializeDataFromTranscribe(message: any): string;
|
|
12
|
-
private sendDataToTranscribe;
|
|
13
|
-
private sendEncodedDataToTranscribe;
|
|
14
|
-
private getAudioEventMessage;
|
|
15
|
-
private pcmEncode;
|
|
16
|
-
private inputSampleRate;
|
|
17
|
-
private downsampleBuffer;
|
|
18
|
-
private openConnectionWithTranscribe;
|
|
19
|
-
private generateTranscribeUrl;
|
|
20
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { AbstractIdentifyPredictionsProvider } from '../types/Providers';
|
|
2
|
-
import { IdentifyLabelsInput, IdentifyLabelsOutput, IdentifyEntitiesInput, IdentifyEntitiesOutput, IdentifyTextInput, IdentifyTextOutput } from '../types';
|
|
3
|
-
export declare class AmazonAIIdentifyPredictionsProvider extends AbstractIdentifyPredictionsProvider {
|
|
4
|
-
private rekognitionClient;
|
|
5
|
-
private textractClient;
|
|
6
|
-
constructor();
|
|
7
|
-
getProviderName(): string;
|
|
8
|
-
/**
|
|
9
|
-
* Verify user input source and converts it into source object readable by Rekognition and Textract.
|
|
10
|
-
* Note that Rekognition and Textract use the same source interface, so we need not worry about types.
|
|
11
|
-
* @param {IdentifySource} source - User input source that directs to the object user wants
|
|
12
|
-
* to identify (storage, file, or bytes).
|
|
13
|
-
* @return {Promise<Image>} - Promise resolving to the converted source object.
|
|
14
|
-
*/
|
|
15
|
-
private configureSource;
|
|
16
|
-
/**
|
|
17
|
-
* Recognize text from real-world images and documents (plain text, forms and tables). Detects text in the input
|
|
18
|
-
* image and converts it into machine-readable text.
|
|
19
|
-
* @param {IdentifySource} source - Object containing the source image and feature types to analyze.
|
|
20
|
-
* @return {Promise<IdentifyTextOutput>} - Promise resolving to object containing identified texts.
|
|
21
|
-
*/
|
|
22
|
-
protected identifyText(input: IdentifyTextInput): Promise<IdentifyTextOutput>;
|
|
23
|
-
/**
|
|
24
|
-
* Identify instances of real world entities from an image and if it contains unsafe content.
|
|
25
|
-
* @param {IdentifyLabelsInput} input - Object containing the source image and entity type to identify.
|
|
26
|
-
* @return {Promise<IdentifyLabelsOutput>} - Promise resolving to an array of identified entities.
|
|
27
|
-
*/
|
|
28
|
-
protected identifyLabels(input: IdentifyLabelsInput): Promise<IdentifyLabelsOutput>;
|
|
29
|
-
/**
|
|
30
|
-
* Calls Rekognition.detectLabels and organizes the returned data.
|
|
31
|
-
* @param {DetectLabelsInput} param - parameter to be passed onto Rekognition
|
|
32
|
-
* @return {Promise<IdentifyLabelsOutput>} - Promise resolving to organized detectLabels response.
|
|
33
|
-
*/
|
|
34
|
-
private detectLabels;
|
|
35
|
-
/**
|
|
36
|
-
* Calls Rekognition.detectModerationLabels and organizes the returned data.
|
|
37
|
-
* @param {Rekognition.DetectLabelsRequest} param - Parameter to be passed onto Rekognition
|
|
38
|
-
* @return {Promise<IdentifyLabelsOutput>} - Promise resolving to organized detectModerationLabels response.
|
|
39
|
-
*/
|
|
40
|
-
private detectModerationLabels;
|
|
41
|
-
/**
|
|
42
|
-
* Identify faces within an image that is provided as input, and match faces from a collection
|
|
43
|
-
* or identify celebrities.
|
|
44
|
-
* @param {IdentifyEntityInput} input - object containing the source image and face match options.
|
|
45
|
-
* @return {Promise<IdentifyEntityOutput>} Promise resolving to identify results.
|
|
46
|
-
*/
|
|
47
|
-
protected identifyEntities(input: IdentifyEntitiesInput): Promise<IdentifyEntitiesOutput>;
|
|
48
|
-
private decodeExternalImageId;
|
|
49
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { AbstractInterpretPredictionsProvider } from '../types/Providers';
|
|
2
|
-
import { InterpretTextInput, InterpretTextOutput } from '../types';
|
|
3
|
-
export declare class AmazonAIInterpretPredictionsProvider extends AbstractInterpretPredictionsProvider {
|
|
4
|
-
constructor();
|
|
5
|
-
getProviderName(): string;
|
|
6
|
-
interpretText(input: InterpretTextInput): Promise<InterpretTextOutput>;
|
|
7
|
-
private detectKeyPhrases;
|
|
8
|
-
private detectSyntax;
|
|
9
|
-
private serializeSyntaxFromComprehend;
|
|
10
|
-
private detectSentiment;
|
|
11
|
-
private detectEntities;
|
|
12
|
-
private serializeEntitiesFromComprehend;
|
|
13
|
-
private detectLanguage;
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { AbstractPredictionsProvider } from '../types/Providers';
|
|
2
|
-
import { TranslateTextInput, TextToSpeechInput, SpeechToTextInput, PredictionsOptions, IdentifyTextInput, IdentifyTextOutput, IdentifyLabelsInput, IdentifyLabelsOutput, IdentifyEntitiesInput, IdentifyEntitiesOutput, TranslateTextOutput, TextToSpeechOutput, SpeechToTextOutput, InterpretTextInput, InterpretTextOutput } from '../types';
|
|
3
|
-
export declare class AmazonAIPredictionsProvider extends AbstractPredictionsProvider {
|
|
4
|
-
private convertProvider;
|
|
5
|
-
private identifyProvider;
|
|
6
|
-
private interpretProvider;
|
|
7
|
-
constructor();
|
|
8
|
-
getCategory(): string;
|
|
9
|
-
getProviderName(): string;
|
|
10
|
-
configure(config: PredictionsOptions): PredictionsOptions;
|
|
11
|
-
interpret(input: InterpretTextInput): Promise<InterpretTextOutput>;
|
|
12
|
-
convert(input: TranslateTextInput | TextToSpeechInput | SpeechToTextInput): Promise<TextToSpeechOutput | TranslateTextOutput | SpeechToTextOutput>;
|
|
13
|
-
identify(input: IdentifyTextInput | IdentifyLabelsInput | IdentifyEntitiesInput): Promise<IdentifyTextOutput | IdentifyLabelsOutput | IdentifyEntitiesOutput>;
|
|
14
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { IdentifyTextOutput, Table, KeyValue, Content } from '../types';
|
|
2
|
-
import { Block, BlockList, TextDetectionList } from '../types/AWSTypes';
|
|
3
|
-
/**
|
|
4
|
-
* Organizes blocks from Rekognition API to each of the categories and and structures
|
|
5
|
-
* their data accordingly.
|
|
6
|
-
* @param {BlockList} source - Array containing blocks returned from Textract API.
|
|
7
|
-
* @return {IdentifyTextOutput} - Object that categorizes each block and its information.
|
|
8
|
-
*/
|
|
9
|
-
export declare function categorizeRekognitionBlocks(blocks: TextDetectionList): IdentifyTextOutput;
|
|
10
|
-
/**
|
|
11
|
-
* Organizes blocks from Textract API to each of the categories and and structures
|
|
12
|
-
* their data accordingly.
|
|
13
|
-
* @param {BlockList} source - Array containing blocks returned from Textract API.
|
|
14
|
-
* @return {IdentifyTextOutput} - Object that categorizes each block and its information.
|
|
15
|
-
*/
|
|
16
|
-
export declare function categorizeTextractBlocks(blocks: BlockList): IdentifyTextOutput;
|
|
17
|
-
/**
|
|
18
|
-
* Constructs a table object using data from its children cells.
|
|
19
|
-
* @param {Block} table - Table block that has references (`Relationships`) to its cells
|
|
20
|
-
* @param {[id: string]: Block} blockMap - Maps block Ids to blocks.
|
|
21
|
-
*/
|
|
22
|
-
export declare function constructTable(table: Block, blockMap: {
|
|
23
|
-
[key: string]: Block;
|
|
24
|
-
}): Table;
|
|
25
|
-
/**
|
|
26
|
-
* Constructs a key value object from its children key and value blocks.
|
|
27
|
-
* @param {Block} KeyValue - KeyValue block that has references (`Relationships`) to its children.
|
|
28
|
-
* @param {[id: string]: Block} blockMap - Maps block Ids to blocks.
|
|
29
|
-
*/
|
|
30
|
-
export declare function constructKeyValue(keyBlock: Block, blockMap: {
|
|
31
|
-
[key: string]: Block;
|
|
32
|
-
}): KeyValue;
|
|
33
|
-
/**
|
|
34
|
-
* Extracts text and selection from input block's children.
|
|
35
|
-
* @param {Block}} block - Block that we want to extract contents from.
|
|
36
|
-
* @param {[id: string]: Block} blockMap - Maps block Ids to blocks.
|
|
37
|
-
*/
|
|
38
|
-
export declare function extractContentsFromBlock(block: Block, blockMap: {
|
|
39
|
-
[id: string]: Block;
|
|
40
|
-
}): Content;
|
package/lib/Providers/Utils.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Changes object keys to camel case. If optional parameter `keys` is given, then we extract only the
|
|
3
|
-
* keys specified in `keys`.
|
|
4
|
-
*/
|
|
5
|
-
export declare function makeCamelCase(obj: object, keys?: string[]): {};
|
|
6
|
-
/**
|
|
7
|
-
* Given an array of object, call makeCamelCase(...) on each option.
|
|
8
|
-
*/
|
|
9
|
-
export declare function makeCamelCaseArray(objArr: object[], keys?: string[]): {}[];
|
|
10
|
-
/**
|
|
11
|
-
* Converts blob to array buffer
|
|
12
|
-
*/
|
|
13
|
-
export declare function blobToArrayBuffer(blob: Blob): Promise<Uint8Array>;
|
package/lib/Providers/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { AmazonAIConvertPredictionsProvider } from './AmazonAIConvertPredictionsProvider';
|
|
2
|
-
import { AmazonAIIdentifyPredictionsProvider } from './AmazonAIIdentifyPredictionsProvider';
|
|
3
|
-
import { AmazonAIInterpretPredictionsProvider } from './AmazonAIInterpretPredictionsProvider';
|
|
4
|
-
import { AmazonAIPredictionsProvider } from './AmazonAIPredictionsProvider';
|
|
5
|
-
export { AmazonAIConvertPredictionsProvider, AmazonAIIdentifyPredictionsProvider, AmazonAIInterpretPredictionsProvider, AmazonAIPredictionsProvider, };
|
package/lib/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Predictions } from './Predictions';
|
|
2
|
-
import { AmazonAIConvertPredictionsProvider, AmazonAIIdentifyPredictionsProvider, AmazonAIPredictionsProvider, AmazonAIInterpretPredictionsProvider } from './Providers';
|
|
3
|
-
export * from './types';
|
|
4
|
-
export { Predictions, AmazonAIIdentifyPredictionsProvider, AmazonAIConvertPredictionsProvider, AmazonAIPredictionsProvider, AmazonAIInterpretPredictionsProvider, };
|
package/lib/types/AWSTypes.d.ts
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Geometry, Relationship } from './Predictions';
|
|
3
|
-
export declare type BlockList = Block[];
|
|
4
|
-
export interface Block {
|
|
5
|
-
/**
|
|
6
|
-
* <p>The type of text that's recognized in a block. In text-detection operations, the following types are returned:</p> <ul> <li> <p> <i>PAGE</i> - Contains a list of the LINE Block objects that are detected on a document page.</p> </li> <li> <p> <i>WORD</i> - A word detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.</p> </li> <li> <p> <i>LINE</i> - A string of tab-delimited, contiguous words that's detected on a document page.</p> </li> </ul> <p>In text analysis operations, the following types are returned:</p> <ul> <li> <p> <i>PAGE</i> - Contains a list of child Block objects that are detected on a document page.</p> </li> <li> <p> <i>KEY_VALUE_SET</i> - Stores the KEY and VALUE Block objects for a field that's detected on a document page. Use the <code>EntityType</code> field to determine if a KEY_VALUE_SET object is a KEY Block object or a VALUE Block object. </p> </li> <li> <p> <i>WORD</i> - A word detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces that's detected on a document page.</p> </li> <li> <p> <i>LINE</i> - A string of tab-delimited, contiguous words that's detected on a document page.</p> </li> <li> <p> <i>TABLE</i> - A table that's detected on a document page. A table is any grid-based information with 2 or more rows or columns with a cell span of 1 row and 1 column each. </p> </li> <li> <p> <i>CELL</i> - A cell within a detected table. The cell is the parent of the block that contains the text in the cell.</p> </li> <li> <p> <i>SELECTION_ELEMENT</i> - A selectable element such as a radio button or checkbox that's detected on a document page. Use the value of <code>SelectionStatus</code> to determine the status of the selection element.</p> </li> </ul>
|
|
7
|
-
*/
|
|
8
|
-
BlockType?: 'KEY_VALUE_SET' | 'PAGE' | 'LINE' | 'WORD' | 'TABLE' | 'CELL' | 'SELECTION_ELEMENT' | string;
|
|
9
|
-
/**
|
|
10
|
-
* <p>The confidence that Amazon Textract has in the accuracy of the recognized text and the accuracy of the geometry points around the recognized text.</p>
|
|
11
|
-
*/
|
|
12
|
-
Confidence?: number;
|
|
13
|
-
/**
|
|
14
|
-
* <p>The word or line of text that's recognized by Amazon Textract. </p>
|
|
15
|
-
*/
|
|
16
|
-
Text?: string;
|
|
17
|
-
/**
|
|
18
|
-
* <p>The row in which a table cell is located. The first row position is 1. <code>RowIndex</code> isn't returned by <code>DetectDocumentText</code> and <code>GetDocumentTextDetection</code>.</p>
|
|
19
|
-
*/
|
|
20
|
-
RowIndex?: number;
|
|
21
|
-
/**
|
|
22
|
-
* <p>The column in which a table cell appears. The first column position is 1. <code>ColumnIndex</code> isn't returned by <code>DetectDocumentText</code> and <code>GetDocumentTextDetection</code>.</p>
|
|
23
|
-
*/
|
|
24
|
-
ColumnIndex?: number;
|
|
25
|
-
/**
|
|
26
|
-
* <p>The number of rows that a table spans. <code>RowSpan</code> isn't returned by <code>DetectDocumentText</code> and <code>GetDocumentTextDetection</code>.</p>
|
|
27
|
-
*/
|
|
28
|
-
RowSpan?: number;
|
|
29
|
-
/**
|
|
30
|
-
* <p>The number of columns that a table cell spans. <code>ColumnSpan</code> isn't returned by <code>DetectDocumentText</code> and <code>GetDocumentTextDetection</code>. </p>
|
|
31
|
-
*/
|
|
32
|
-
ColumnSpan?: number;
|
|
33
|
-
/**
|
|
34
|
-
* <p>The location of the recognized text on the image. It includes an axis-aligned, coarse bounding box that surrounds the text, and a finer-grain polygon for more accurate spatial information. </p>
|
|
35
|
-
*/
|
|
36
|
-
Geometry?: Geometry;
|
|
37
|
-
/**
|
|
38
|
-
* <p>The identifier for the recognized text. The identifier is only unique for a single operation. </p>
|
|
39
|
-
*/
|
|
40
|
-
Id?: string;
|
|
41
|
-
/**
|
|
42
|
-
* <p>A list of child blocks of the current block. For example a LINE object has child blocks for each WORD block that's part of the line of text. There aren't Relationship objects in the list for relationships that don't exist, such as when the current block has no child blocks. The list size can be the following:</p> <ul> <li> <p>0 - The block has no child blocks.</p> </li> <li> <p>1 - The block has child blocks.</p> </li> </ul>
|
|
43
|
-
*/
|
|
44
|
-
Relationships?: Array<Relationship> | Iterable<Relationship>;
|
|
45
|
-
/**
|
|
46
|
-
* <p>The type of entity. The following can be returned:</p> <ul> <li> <p> <i>KEY</i> - An identifier for a field on the document.</p> </li> <li> <p> <i>VALUE</i> - The field text.</p> </li> </ul> <p> <code>EntityTypes</code> isn't returned by <code>DetectDocumentText</code> and <code>GetDocumentTextDetection</code>.</p>
|
|
47
|
-
*/
|
|
48
|
-
EntityTypes?: Array<'KEY' | 'VALUE' | string> | Iterable<'KEY' | 'VALUE' | string>;
|
|
49
|
-
/**
|
|
50
|
-
* <p>The selection status of a selectable element such as a radio button or checkbox. </p>
|
|
51
|
-
*/
|
|
52
|
-
SelectionStatus?: 'SELECTED' | 'NOT_SELECTED' | string;
|
|
53
|
-
/**
|
|
54
|
-
* <p>The page in which a block was detected. <code>Page</code> is returned by asynchronous operations. Page values greater than 1 are only returned for multi-page documents that are in PDF format. A scanned image (JPG/PNG), even if it contains multiple document pages, is always considered to be a single-page document and the value of <code>Page</code> is always 1. Synchronous operations don't return <code>Page</code> as every input document is considered to be a single-page document.</p>
|
|
55
|
-
*/
|
|
56
|
-
Page?: number;
|
|
57
|
-
}
|
|
58
|
-
export declare type TextDetectionList = TextDetection[];
|
|
59
|
-
export interface TextDetection {
|
|
60
|
-
/**
|
|
61
|
-
* <p>The word or line of text recognized by Amazon Rekognition. </p>
|
|
62
|
-
*/
|
|
63
|
-
DetectedText?: string;
|
|
64
|
-
/**
|
|
65
|
-
* <p>The type of text that was detected.</p>
|
|
66
|
-
*/
|
|
67
|
-
Type?: 'LINE' | 'WORD' | string;
|
|
68
|
-
/**
|
|
69
|
-
* <p>The identifier for the detected text. The identifier is only unique for a single call to <code>DetectText</code>. </p>
|
|
70
|
-
*/
|
|
71
|
-
Id?: number;
|
|
72
|
-
/**
|
|
73
|
-
* <p>The Parent identifier for the detected text identified by the value of <code>ID</code>. If the type of detected text is <code>LINE</code>, the value of <code>ParentId</code> is <code>Null</code>. </p>
|
|
74
|
-
*/
|
|
75
|
-
ParentId?: number;
|
|
76
|
-
/**
|
|
77
|
-
* <p>The confidence that Amazon Rekognition has in the accuracy of the detected text and the accuracy of the geometry points around the detected text.</p>
|
|
78
|
-
*/
|
|
79
|
-
Confidence?: number;
|
|
80
|
-
/**
|
|
81
|
-
* <p>The location of the detected text on the image. Includes an axis aligned coarse bounding box surrounding the text and a finer grain polygon for more accurate spatial information.</p>
|
|
82
|
-
*/
|
|
83
|
-
Geometry?: Geometry;
|
|
84
|
-
}
|
|
85
|
-
export interface Image {
|
|
86
|
-
/**
|
|
87
|
-
* <p>Blob of image bytes up to 5 MBs.</p>
|
|
88
|
-
*/
|
|
89
|
-
Bytes?: Uint8Array;
|
|
90
|
-
/**
|
|
91
|
-
* <p>Identifies an S3 object as the image source.</p>
|
|
92
|
-
*/
|
|
93
|
-
S3Object?: S3Object;
|
|
94
|
-
}
|
|
95
|
-
export declare type ImageBlob = Buffer | Uint8Array | Blob | string;
|
|
96
|
-
export declare type S3Bucket = string;
|
|
97
|
-
export interface S3Object {
|
|
98
|
-
/**
|
|
99
|
-
* Name of the S3 bucket.
|
|
100
|
-
*/
|
|
101
|
-
Bucket?: S3Bucket;
|
|
102
|
-
/**
|
|
103
|
-
* S3 object key name.
|
|
104
|
-
*/
|
|
105
|
-
Name?: S3ObjectName;
|
|
106
|
-
/**
|
|
107
|
-
* If the bucket is versioning enabled, you can specify the object version.
|
|
108
|
-
*/
|
|
109
|
-
Version?: S3ObjectVersion;
|
|
110
|
-
}
|
|
111
|
-
export declare type S3ObjectName = string;
|
|
112
|
-
export declare type S3ObjectVersion = string;
|
|
113
|
-
/**
|
|
114
|
-
* <p>The input document, either as bytes or as an S3 object.</p> <p>You pass image bytes to an Amazon Textract API operation by using the <code>Bytes</code> property. For example, you would use the <code>Bytes</code> property to pass a document loaded from a local file system. Image bytes passed by using the <code>Bytes</code> property must be base64 encoded. Your code might not need to encode document file bytes if you're using an AWS SDK to call Amazon Textract API operations. </p> <p>You pass images stored in an S3 bucket to an Amazon Textract API operation by using the <code>S3Object</code> property. Documents stored in an S3 bucket don't need to be base64 encoded.</p> <p>The AWS Region for the S3 bucket that contains the S3 object must match the AWS Region that you use for Amazon Textract operations.</p> <p>If you use the AWS CLI to call Amazon Textract operations, passing image bytes using the Bytes property isn't supported. You must first upload the document to an Amazon S3 bucket, and then call the operation using the S3Object property.</p> <p>For Amazon Textract to process an S3 object, the user must have permission to access the S3 object. </p>
|
|
115
|
-
*/
|
|
116
|
-
export interface Document {
|
|
117
|
-
/**
|
|
118
|
-
* <p>A blob of base-64 encoded documents bytes. The maximum size of a document that's provided in a blob of bytes is 5 MB. The document bytes must be in PNG or JPG format.</p> <p>If you are using an AWS SDK to call Amazon Textract, you might not need to base64-encode image bytes passed using the <code>Bytes</code> field. </p>
|
|
119
|
-
*/
|
|
120
|
-
Bytes?: Uint8Array;
|
|
121
|
-
/**
|
|
122
|
-
* <p>Identifies an S3 object as the document source. The maximum size of a document stored in an S3 bucket is 5 MB.</p>
|
|
123
|
-
*/
|
|
124
|
-
S3Object?: S3Object;
|
|
125
|
-
}
|