@aws-amplify/predictions 4.0.62-unstable.4 → 4.0.63
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 +24 -0
- package/build.js +5 -0
- package/dist/aws-amplify-predictions.js +101151 -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
|
@@ -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
|
-
}
|
package/lib/types/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Predictions';
|
package/lib-esm/.tsbuildinfo
DELETED