@aws-amplify/predictions 4.0.58-unstable.2 → 4.0.58

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 CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.0.58](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/predictions@4.0.57...@aws-amplify/predictions@4.0.58) (2022-10-25)
7
+
8
+ **Note:** Version bump only for package @aws-amplify/predictions
9
+
10
+
11
+
12
+
13
+
6
14
  ## [4.0.57](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/predictions@4.0.56...@aws-amplify/predictions@4.0.57) (2022-10-14)
7
15
 
8
16
  **Note:** Version bump only for package @aws-amplify/predictions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/predictions",
3
- "version": "4.0.58-unstable.2+89bdeb1e4",
3
+ "version": "4.0.58",
4
4
  "description": "Machine learning category of aws-amplify",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib-esm/index.js",
@@ -40,8 +40,8 @@
40
40
  },
41
41
  "homepage": "https://aws-amplify.github.io/",
42
42
  "dependencies": {
43
- "@aws-amplify/core": "4.7.9-unstable.2+89bdeb1e4",
44
- "@aws-amplify/storage": "4.5.11-unstable.2+89bdeb1e4",
43
+ "@aws-amplify/core": "4.7.9",
44
+ "@aws-amplify/storage": "4.5.11",
45
45
  "@aws-sdk/client-comprehend": "3.6.1",
46
46
  "@aws-sdk/client-polly": "3.6.1",
47
47
  "@aws-sdk/client-rekognition": "3.6.1",
@@ -95,5 +95,5 @@
95
95
  "lib-esm"
96
96
  ]
97
97
  },
98
- "gitHead": "89bdeb1e4ec45c1a34e7dfe960b341de99906ed3"
98
+ "gitHead": "be5bf2dc68c9c011c3876f003c14bc98b392c82d"
99
99
  }
@@ -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,24 +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
- }
21
- /**
22
- * @deprecated use named import
23
- */
24
- export default AmazonAIConvertPredictionsProvider;
@@ -1,53 +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
- }
50
- /**
51
- * @deprecated use named import
52
- */
53
- export default AmazonAIIdentifyPredictionsProvider;
@@ -1,18 +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
- }
15
- /**
16
- * @deprecated use named import
17
- */
18
- export default AmazonAIInterpretPredictionsProvider;
@@ -1,18 +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
- }
15
- /**
16
- * @deprecated use named import
17
- */
18
- export default AmazonAIPredictionsProvider;
@@ -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;
@@ -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>;
@@ -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,8 +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, };
5
- /**
6
- * @deprecated use named import
7
- */
8
- export default Predictions;
@@ -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
- }
@@ -1,281 +0,0 @@
1
- /// <reference types="node" />
2
- /**
3
- * Base types
4
- */
5
- export interface PredictionsOptions {
6
- [key: string]: any;
7
- }
8
- export interface ProviderOptions {
9
- providerName?: string;
10
- }
11
- /**
12
- * Convert types
13
- */
14
- export declare enum InterpretTextCategories {
15
- ALL = "ALL",
16
- LANGUAGE = "LANGUAGE",
17
- ENTITIES = "ENTITIES",
18
- SENTIMENT = "SENTIMENT",
19
- SYNTAX = "SYNTAX",
20
- KEY_PHRASES = "KEY_PHRASES"
21
- }
22
- export interface InterpretTextInput {
23
- text: InterpretTextInputLanguage | InterpretTextOthers | InterpretTextAll;
24
- }
25
- export interface InterpretTextInputLanguage {
26
- source: {
27
- text: string;
28
- };
29
- type: InterpretTextCategories.LANGUAGE;
30
- }
31
- export interface InterpretTextOthers {
32
- source: {
33
- text: string;
34
- language: string;
35
- };
36
- type: InterpretTextCategories.ENTITIES | InterpretTextCategories.SENTIMENT | InterpretTextCategories.SYNTAX | InterpretTextCategories.KEY_PHRASES;
37
- }
38
- export interface InterpretTextAll {
39
- source: {
40
- text: string;
41
- };
42
- type: InterpretTextCategories.ALL;
43
- }
44
- export interface TextEntities {
45
- type: string;
46
- text: string;
47
- }
48
- export interface KeyPhrases {
49
- text: string;
50
- }
51
- export interface TextSyntax {
52
- text: string;
53
- syntax: string;
54
- }
55
- export interface TextSentiment {
56
- predominant: string;
57
- positive: number;
58
- negative: number;
59
- neutral: number;
60
- mixed: number;
61
- }
62
- export interface InterpretTextOutput {
63
- textInterpretation: {
64
- language?: string;
65
- textEntities?: Array<TextEntities>;
66
- keyPhrases?: Array<KeyPhrases>;
67
- sentiment?: TextSentiment;
68
- syntax?: Array<TextSyntax>;
69
- };
70
- }
71
- export interface TranslateTextInput {
72
- translateText: {
73
- source: {
74
- text: string;
75
- language?: string;
76
- };
77
- targetLanguage?: string;
78
- };
79
- }
80
- export interface TranslateTextOutput {
81
- text: string;
82
- language: string;
83
- }
84
- export interface TextToSpeechInput {
85
- textToSpeech: {
86
- source: {
87
- text: string;
88
- };
89
- terminology?: string;
90
- voiceId?: string;
91
- };
92
- }
93
- export interface TextToSpeechOutput {
94
- speech: {
95
- url: string;
96
- };
97
- audioStream: Buffer;
98
- text: string;
99
- }
100
- export interface StorageSource {
101
- key: string;
102
- level?: 'public' | 'private' | 'protected';
103
- identityId?: string;
104
- }
105
- export interface FileSource {
106
- file: File;
107
- }
108
- export interface BytesSource {
109
- bytes: Buffer | ArrayBuffer | Blob | string;
110
- }
111
- export interface SpeechToTextInput {
112
- transcription: {
113
- source: BytesSource;
114
- language?: string;
115
- };
116
- }
117
- export interface SpeechToTextOutput {
118
- transcription: {
119
- fullText: string;
120
- };
121
- }
122
- export declare type IdentifySource = StorageSource | FileSource | BytesSource;
123
- export interface IdentifyTextInput {
124
- text: {
125
- source: IdentifySource;
126
- format?: 'PLAIN' | 'FORM' | 'TABLE' | 'ALL';
127
- };
128
- }
129
- export interface Word {
130
- text?: string;
131
- polygon?: Polygon;
132
- boundingBox?: BoundingBox;
133
- }
134
- export interface LineDetailed {
135
- text?: string;
136
- polygon?: Polygon;
137
- boundingBox?: BoundingBox;
138
- page?: number;
139
- }
140
- export interface Content {
141
- text?: string;
142
- selected?: boolean;
143
- }
144
- export interface TableCell extends Content {
145
- boundingBox?: BoundingBox;
146
- polygon?: Polygon;
147
- rowSpan?: Number;
148
- columnSpan?: Number;
149
- }
150
- export interface Table {
151
- size: {
152
- rows: number;
153
- columns: number;
154
- };
155
- table: TableCell[][];
156
- polygon: Polygon;
157
- boundingBox: BoundingBox;
158
- }
159
- export interface KeyValue {
160
- key: string;
161
- value: Content;
162
- polygon: Polygon;
163
- boundingBox: BoundingBox;
164
- }
165
- export interface IdentifyTextOutput {
166
- text: {
167
- fullText: string;
168
- lines: string[];
169
- linesDetailed: LineDetailed[];
170
- words: Word[];
171
- keyValues?: KeyValue[];
172
- tables?: Table[];
173
- selections?: {
174
- selected: boolean;
175
- polygon: Polygon;
176
- boundingBox: BoundingBox;
177
- }[];
178
- };
179
- }
180
- export interface IdentifyLabelsInput {
181
- labels: {
182
- source: IdentifySource;
183
- type: 'LABELS' | 'UNSAFE' | 'ALL';
184
- };
185
- }
186
- export interface Point {
187
- x?: Number;
188
- y?: Number;
189
- }
190
- export declare type Polygon = Array<Point> | Iterable<Point>;
191
- export interface BoundingBox {
192
- width?: Number;
193
- height?: Number;
194
- left?: Number;
195
- top?: Number;
196
- }
197
- export interface IdentifyLabelsOutput {
198
- labels?: {
199
- name: string;
200
- boundingBoxes: BoundingBox[];
201
- metadata?: Object;
202
- }[];
203
- unsafe?: 'YES' | 'NO' | 'UNKNOWN';
204
- }
205
- export interface IdentifyEntitiesInput {
206
- entities: IdentifyFromCollection | IdentifyCelebrities | IdentifyEntities;
207
- }
208
- export interface IdentifyFromCollection {
209
- source: IdentifySource;
210
- collection: true;
211
- collectionId?: string;
212
- maxEntities?: number;
213
- }
214
- export interface IdentifyCelebrities {
215
- source: IdentifySource;
216
- celebrityDetection: true;
217
- }
218
- export interface IdentifyEntities {
219
- source: IdentifySource;
220
- }
221
- export interface FaceAttributes {
222
- smile?: boolean;
223
- eyeglasses?: boolean;
224
- sunglasses?: boolean;
225
- gender?: string;
226
- beard?: boolean;
227
- mustache?: boolean;
228
- eyesOpen?: boolean;
229
- mouthOpen?: boolean;
230
- emotions?: string[];
231
- }
232
- export interface IdentifyEntitiesOutput {
233
- entities: {
234
- boundingBox?: BoundingBox;
235
- ageRange?: {
236
- low?: Number;
237
- high?: Number;
238
- };
239
- landmarks?: {
240
- type?: string;
241
- x?: number;
242
- y?: number;
243
- }[];
244
- attributes?: FaceAttributes;
245
- metadata?: object;
246
- }[];
247
- }
248
- export declare function isIdentifyFromCollection(obj: any): obj is IdentifyFromCollection;
249
- export declare function isIdentifyCelebrities(obj: any): obj is IdentifyCelebrities;
250
- export declare function isTranslateTextInput(obj: any): obj is TranslateTextInput;
251
- export declare function isTextToSpeechInput(obj: any): obj is TextToSpeechInput;
252
- export declare function isSpeechToTextInput(obj: any): obj is SpeechToTextInput;
253
- export declare function isStorageSource(obj: any): obj is StorageSource;
254
- export declare function isFileSource(obj: any): obj is FileSource;
255
- export declare function isBytesSource(obj: any): obj is BytesSource;
256
- export declare function isIdentifyTextInput(obj: any): obj is IdentifyTextInput;
257
- export declare function isIdentifyLabelsInput(obj: any): obj is IdentifyLabelsInput;
258
- export declare function isIdentifyEntitiesInput(obj: any): obj is IdentifyEntitiesInput;
259
- export declare function isInterpretTextInput(obj: any): obj is InterpretTextInput;
260
- export interface Geometry {
261
- /**
262
- * <p>An axis-aligned coarse representation of the detected text's location on the image.</p>
263
- */
264
- BoundingBox?: BoundingBox;
265
- /**
266
- * <p>Within the bounding box, a fine-grained polygon around the detected text.</p>
267
- */
268
- Polygon?: Array<Point> | Iterable<Point>;
269
- }
270
- export interface Relationship {
271
- /**
272
- * <p>The type of relationship that the blocks in the IDs array have with the current block. The relationship can be <code>VALUE</code> or <code>CHILD</code>.</p>
273
- */
274
- Type?: 'VALUE' | 'CHILD' | string;
275
- /**
276
- * <p>An array of IDs for related blocks. You can get the type of the relationship from the <code>Type</code> element.</p>
277
- */
278
- Ids?: Array<string> | Iterable<string>;
279
- }
280
- export declare type FeatureType = 'TABLES' | 'FORMS' | string;
281
- export declare type FeatureTypes = FeatureType[];
@@ -1,9 +0,0 @@
1
- import { TranslateTextInput, TextToSpeechInput, SpeechToTextInput, TranslateTextOutput, TextToSpeechOutput, SpeechToTextOutput } from '../Predictions';
2
- import { AbstractPredictionsProvider } from './AbstractPredictionsProvider';
3
- export declare abstract class AbstractConvertPredictionsProvider extends AbstractPredictionsProvider {
4
- getCategory(): string;
5
- convert(input: TranslateTextInput | TextToSpeechInput | SpeechToTextInput): Promise<TextToSpeechOutput | TranslateTextOutput | SpeechToTextOutput>;
6
- protected translateText(translateTextInput: TranslateTextInput): Promise<TranslateTextOutput>;
7
- protected convertTextToSpeech(textToSpeechInput: TextToSpeechInput): Promise<TextToSpeechOutput>;
8
- protected convertSpeechToText(speechToTextInput: SpeechToTextInput): Promise<SpeechToTextOutput>;
9
- }
@@ -1,9 +0,0 @@
1
- import { AbstractPredictionsProvider } from './AbstractPredictionsProvider';
2
- import { IdentifyLabelsInput, IdentifyEntitiesInput, IdentifyTextInput, IdentifyTextOutput, IdentifyLabelsOutput, IdentifyEntitiesOutput } from '../Predictions';
3
- export declare abstract class AbstractIdentifyPredictionsProvider extends AbstractPredictionsProvider {
4
- getCategory(): string;
5
- identify(input: IdentifyTextInput | IdentifyLabelsInput | IdentifyEntitiesInput): Promise<IdentifyTextOutput | IdentifyLabelsOutput | IdentifyEntitiesOutput>;
6
- protected identifyText(input: IdentifyTextInput): Promise<IdentifyTextOutput>;
7
- protected identifyLabels(input: IdentifyLabelsInput): Promise<IdentifyLabelsOutput>;
8
- protected identifyEntities(input: IdentifyEntitiesInput): Promise<IdentifyEntitiesOutput>;
9
- }
@@ -1,7 +0,0 @@
1
- import { AbstractPredictionsProvider } from './AbstractPredictionsProvider';
2
- import { InterpretTextInput, InterpretTextOutput } from '../Predictions';
3
- export declare abstract class AbstractInterpretPredictionsProvider extends AbstractPredictionsProvider {
4
- getCategory(): string;
5
- interpret(input: InterpretTextInput): Promise<InterpretTextOutput>;
6
- protected interpretText(input: InterpretTextInput): Promise<InterpretTextOutput>;
7
- }
@@ -1,7 +0,0 @@
1
- import { PredictionsOptions } from '..';
2
- export declare abstract class AbstractPredictionsProvider {
3
- protected _config: PredictionsOptions;
4
- configure(config: PredictionsOptions): PredictionsOptions;
5
- abstract getProviderName(): string;
6
- abstract getCategory(): string;
7
- }
@@ -1,4 +0,0 @@
1
- export * from './AbstractPredictionsProvider';
2
- export * from './AbstractConvertPredictionsProvider';
3
- export * from './AbstractIdentifyPredictionsProvider';
4
- export * from './AbstractInterpretPredictionsProvider';
@@ -1 +0,0 @@
1
- export * from './Predictions';