@aws-sdk/client-comprehend 3.218.0 → 3.223.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.
@@ -4019,6 +4019,10 @@ const serializeAws_json1_1BatchDetectTargetedSentimentRequest = (input, context)
4019
4019
  };
4020
4020
  const serializeAws_json1_1ClassifyDocumentRequest = (input, context) => {
4021
4021
  return {
4022
+ ...(input.Bytes != null && { Bytes: context.base64Encoder(input.Bytes) }),
4023
+ ...(input.DocumentReaderConfig != null && {
4024
+ DocumentReaderConfig: serializeAws_json1_1DocumentReaderConfig(input.DocumentReaderConfig, context),
4025
+ }),
4022
4026
  ...(input.EndpointArn != null && { EndpointArn: input.EndpointArn }),
4023
4027
  ...(input.Text != null && { Text: input.Text }),
4024
4028
  };
@@ -4177,6 +4181,10 @@ const serializeAws_json1_1DetectDominantLanguageRequest = (input, context) => {
4177
4181
  };
4178
4182
  const serializeAws_json1_1DetectEntitiesRequest = (input, context) => {
4179
4183
  return {
4184
+ ...(input.Bytes != null && { Bytes: context.base64Encoder(input.Bytes) }),
4185
+ ...(input.DocumentReaderConfig != null && {
4186
+ DocumentReaderConfig: serializeAws_json1_1DocumentReaderConfig(input.DocumentReaderConfig, context),
4187
+ }),
4180
4188
  ...(input.EndpointArn != null && { EndpointArn: input.EndpointArn }),
4181
4189
  ...(input.LanguageCode != null && { LanguageCode: input.LanguageCode }),
4182
4190
  ...(input.Text != null && { Text: input.Text }),
@@ -4961,6 +4969,41 @@ const deserializeAws_json1_1BatchSizeLimitExceededException = (output, context)
4961
4969
  Message: __expectString(output.Message),
4962
4970
  };
4963
4971
  };
4972
+ const deserializeAws_json1_1Block = (output, context) => {
4973
+ return {
4974
+ BlockType: __expectString(output.BlockType),
4975
+ Geometry: output.Geometry != null ? deserializeAws_json1_1Geometry(output.Geometry, context) : undefined,
4976
+ Id: __expectString(output.Id),
4977
+ Page: __expectInt32(output.Page),
4978
+ Relationships: output.Relationships != null
4979
+ ? deserializeAws_json1_1ListOfRelationships(output.Relationships, context)
4980
+ : undefined,
4981
+ Text: __expectString(output.Text),
4982
+ };
4983
+ };
4984
+ const deserializeAws_json1_1BlockReference = (output, context) => {
4985
+ return {
4986
+ BeginOffset: __expectInt32(output.BeginOffset),
4987
+ BlockId: __expectString(output.BlockId),
4988
+ ChildBlocks: output.ChildBlocks != null ? deserializeAws_json1_1ListOfChildBlocks(output.ChildBlocks, context) : undefined,
4989
+ EndOffset: __expectInt32(output.EndOffset),
4990
+ };
4991
+ };
4992
+ const deserializeAws_json1_1BoundingBox = (output, context) => {
4993
+ return {
4994
+ Height: __limitedParseFloat32(output.Height),
4995
+ Left: __limitedParseFloat32(output.Left),
4996
+ Top: __limitedParseFloat32(output.Top),
4997
+ Width: __limitedParseFloat32(output.Width),
4998
+ };
4999
+ };
5000
+ const deserializeAws_json1_1ChildBlock = (output, context) => {
5001
+ return {
5002
+ BeginOffset: __expectInt32(output.BeginOffset),
5003
+ ChildBlockId: __expectString(output.ChildBlockId),
5004
+ EndOffset: __expectInt32(output.EndOffset),
5005
+ };
5006
+ };
4964
5007
  const deserializeAws_json1_1ClassifierEvaluationMetrics = (output, context) => {
4965
5008
  return {
4966
5009
  Accuracy: __limitedParseDouble(output.Accuracy),
@@ -4986,6 +5029,11 @@ const deserializeAws_json1_1ClassifierMetadata = (output, context) => {
4986
5029
  const deserializeAws_json1_1ClassifyDocumentResponse = (output, context) => {
4987
5030
  return {
4988
5031
  Classes: output.Classes != null ? deserializeAws_json1_1ListOfClasses(output.Classes, context) : undefined,
5032
+ DocumentMetadata: output.DocumentMetadata != null
5033
+ ? deserializeAws_json1_1DocumentMetadata(output.DocumentMetadata, context)
5034
+ : undefined,
5035
+ DocumentType: output.DocumentType != null ? deserializeAws_json1_1ListOfDocumentType(output.DocumentType, context) : undefined,
5036
+ Errors: output.Errors != null ? deserializeAws_json1_1ListOfErrors(output.Errors, context) : undefined,
4989
5037
  Labels: output.Labels != null ? deserializeAws_json1_1ListOfLabels(output.Labels, context) : undefined,
4990
5038
  };
4991
5039
  };
@@ -5129,7 +5177,13 @@ const deserializeAws_json1_1DetectDominantLanguageResponse = (output, context) =
5129
5177
  };
5130
5178
  const deserializeAws_json1_1DetectEntitiesResponse = (output, context) => {
5131
5179
  return {
5180
+ Blocks: output.Blocks != null ? deserializeAws_json1_1ListOfBlocks(output.Blocks, context) : undefined,
5181
+ DocumentMetadata: output.DocumentMetadata != null
5182
+ ? deserializeAws_json1_1DocumentMetadata(output.DocumentMetadata, context)
5183
+ : undefined,
5184
+ DocumentType: output.DocumentType != null ? deserializeAws_json1_1ListOfDocumentType(output.DocumentType, context) : undefined,
5132
5185
  Entities: output.Entities != null ? deserializeAws_json1_1ListOfEntities(output.Entities, context) : undefined,
5186
+ Errors: output.Errors != null ? deserializeAws_json1_1ListOfErrors(output.Errors, context) : undefined,
5133
5187
  };
5134
5188
  };
5135
5189
  const deserializeAws_json1_1DetectKeyPhrasesResponse = (output, context) => {
@@ -5163,6 +5217,7 @@ const deserializeAws_json1_1DetectTargetedSentimentResponse = (output, context)
5163
5217
  const deserializeAws_json1_1DocumentClass = (output, context) => {
5164
5218
  return {
5165
5219
  Name: __expectString(output.Name),
5220
+ Page: __expectInt32(output.Page),
5166
5221
  Score: __limitedParseFloat32(output.Score),
5167
5222
  };
5168
5223
  };
@@ -5294,9 +5349,18 @@ const deserializeAws_json1_1DocumentClassifierSummary = (output, context) => {
5294
5349
  const deserializeAws_json1_1DocumentLabel = (output, context) => {
5295
5350
  return {
5296
5351
  Name: __expectString(output.Name),
5352
+ Page: __expectInt32(output.Page),
5297
5353
  Score: __limitedParseFloat32(output.Score),
5298
5354
  };
5299
5355
  };
5356
+ const deserializeAws_json1_1DocumentMetadata = (output, context) => {
5357
+ return {
5358
+ ExtractedCharacters: output.ExtractedCharacters != null
5359
+ ? deserializeAws_json1_1ListOfExtractedCharacters(output.ExtractedCharacters, context)
5360
+ : undefined,
5361
+ Pages: __expectInt32(output.Pages),
5362
+ };
5363
+ };
5300
5364
  const deserializeAws_json1_1DocumentReaderConfig = (output, context) => {
5301
5365
  return {
5302
5366
  DocumentReadAction: __expectString(output.DocumentReadAction),
@@ -5306,6 +5370,12 @@ const deserializeAws_json1_1DocumentReaderConfig = (output, context) => {
5306
5370
  : undefined,
5307
5371
  };
5308
5372
  };
5373
+ const deserializeAws_json1_1DocumentTypeListItem = (output, context) => {
5374
+ return {
5375
+ Page: __expectInt32(output.Page),
5376
+ Type: __expectString(output.Type),
5377
+ };
5378
+ };
5309
5379
  const deserializeAws_json1_1DominantLanguage = (output, context) => {
5310
5380
  return {
5311
5381
  LanguageCode: __expectString(output.LanguageCode),
@@ -5409,6 +5479,9 @@ const deserializeAws_json1_1EntitiesDetectionJobPropertiesList = (output, contex
5409
5479
  const deserializeAws_json1_1Entity = (output, context) => {
5410
5480
  return {
5411
5481
  BeginOffset: __expectInt32(output.BeginOffset),
5482
+ BlockReferences: output.BlockReferences != null
5483
+ ? deserializeAws_json1_1ListOfBlockReferences(output.BlockReferences, context)
5484
+ : undefined,
5412
5485
  EndOffset: __expectInt32(output.EndOffset),
5413
5486
  Score: __limitedParseFloat32(output.Score),
5414
5487
  Text: __expectString(output.Text),
@@ -5589,6 +5662,13 @@ const deserializeAws_json1_1EntityTypesListItem = (output, context) => {
5589
5662
  Type: __expectString(output.Type),
5590
5663
  };
5591
5664
  };
5665
+ const deserializeAws_json1_1ErrorsListItem = (output, context) => {
5666
+ return {
5667
+ ErrorCode: __expectString(output.ErrorCode),
5668
+ ErrorMessage: __expectString(output.ErrorMessage),
5669
+ Page: __expectInt32(output.Page),
5670
+ };
5671
+ };
5592
5672
  const deserializeAws_json1_1EventsDetectionJobProperties = (output, context) => {
5593
5673
  return {
5594
5674
  DataAccessRoleArn: __expectString(output.DataAccessRoleArn),
@@ -5622,6 +5702,18 @@ const deserializeAws_json1_1EventsDetectionJobPropertiesList = (output, context)
5622
5702
  });
5623
5703
  return retVal;
5624
5704
  };
5705
+ const deserializeAws_json1_1ExtractedCharactersListItem = (output, context) => {
5706
+ return {
5707
+ Count: __expectInt32(output.Count),
5708
+ Page: __expectInt32(output.Page),
5709
+ };
5710
+ };
5711
+ const deserializeAws_json1_1Geometry = (output, context) => {
5712
+ return {
5713
+ BoundingBox: output.BoundingBox != null ? deserializeAws_json1_1BoundingBox(output.BoundingBox, context) : undefined,
5714
+ Polygon: output.Polygon != null ? deserializeAws_json1_1Polygon(output.Polygon, context) : undefined,
5715
+ };
5716
+ };
5625
5717
  const deserializeAws_json1_1ImportModelResponse = (output, context) => {
5626
5718
  return {
5627
5719
  ModelArn: __expectString(output.ModelArn),
@@ -5646,9 +5738,16 @@ const deserializeAws_json1_1InvalidFilterException = (output, context) => {
5646
5738
  Message: __expectString(output.Message),
5647
5739
  };
5648
5740
  };
5741
+ const deserializeAws_json1_1InvalidRequestDetail = (output, context) => {
5742
+ return {
5743
+ Reason: __expectString(output.Reason),
5744
+ };
5745
+ };
5649
5746
  const deserializeAws_json1_1InvalidRequestException = (output, context) => {
5650
5747
  return {
5748
+ Detail: output.Detail != null ? deserializeAws_json1_1InvalidRequestDetail(output.Detail, context) : undefined,
5651
5749
  Message: __expectString(output.Message),
5750
+ Reason: __expectString(output.Reason),
5652
5751
  };
5653
5752
  };
5654
5753
  const deserializeAws_json1_1JobNotFoundException = (output, context) => {
@@ -5781,6 +5880,39 @@ const deserializeAws_json1_1ListKeyPhrasesDetectionJobsResponse = (output, conte
5781
5880
  NextToken: __expectString(output.NextToken),
5782
5881
  };
5783
5882
  };
5883
+ const deserializeAws_json1_1ListOfBlockReferences = (output, context) => {
5884
+ const retVal = (output || [])
5885
+ .filter((e) => e != null)
5886
+ .map((entry) => {
5887
+ if (entry === null) {
5888
+ return null;
5889
+ }
5890
+ return deserializeAws_json1_1BlockReference(entry, context);
5891
+ });
5892
+ return retVal;
5893
+ };
5894
+ const deserializeAws_json1_1ListOfBlocks = (output, context) => {
5895
+ const retVal = (output || [])
5896
+ .filter((e) => e != null)
5897
+ .map((entry) => {
5898
+ if (entry === null) {
5899
+ return null;
5900
+ }
5901
+ return deserializeAws_json1_1Block(entry, context);
5902
+ });
5903
+ return retVal;
5904
+ };
5905
+ const deserializeAws_json1_1ListOfChildBlocks = (output, context) => {
5906
+ const retVal = (output || [])
5907
+ .filter((e) => e != null)
5908
+ .map((entry) => {
5909
+ if (entry === null) {
5910
+ return null;
5911
+ }
5912
+ return deserializeAws_json1_1ChildBlock(entry, context);
5913
+ });
5914
+ return retVal;
5915
+ };
5784
5916
  const deserializeAws_json1_1ListOfClasses = (output, context) => {
5785
5917
  const retVal = (output || [])
5786
5918
  .filter((e) => e != null)
@@ -5880,6 +6012,17 @@ const deserializeAws_json1_1ListOfDocumentReadFeatureTypes = (output, context) =
5880
6012
  });
5881
6013
  return retVal;
5882
6014
  };
6015
+ const deserializeAws_json1_1ListOfDocumentType = (output, context) => {
6016
+ const retVal = (output || [])
6017
+ .filter((e) => e != null)
6018
+ .map((entry) => {
6019
+ if (entry === null) {
6020
+ return null;
6021
+ }
6022
+ return deserializeAws_json1_1DocumentTypeListItem(entry, context);
6023
+ });
6024
+ return retVal;
6025
+ };
5883
6026
  const deserializeAws_json1_1ListOfDominantLanguages = (output, context) => {
5884
6027
  const retVal = (output || [])
5885
6028
  .filter((e) => e != null)
@@ -5913,6 +6056,28 @@ const deserializeAws_json1_1ListOfEntityLabels = (output, context) => {
5913
6056
  });
5914
6057
  return retVal;
5915
6058
  };
6059
+ const deserializeAws_json1_1ListOfErrors = (output, context) => {
6060
+ const retVal = (output || [])
6061
+ .filter((e) => e != null)
6062
+ .map((entry) => {
6063
+ if (entry === null) {
6064
+ return null;
6065
+ }
6066
+ return deserializeAws_json1_1ErrorsListItem(entry, context);
6067
+ });
6068
+ return retVal;
6069
+ };
6070
+ const deserializeAws_json1_1ListOfExtractedCharacters = (output, context) => {
6071
+ const retVal = (output || [])
6072
+ .filter((e) => e != null)
6073
+ .map((entry) => {
6074
+ if (entry === null) {
6075
+ return null;
6076
+ }
6077
+ return deserializeAws_json1_1ExtractedCharactersListItem(entry, context);
6078
+ });
6079
+ return retVal;
6080
+ };
5916
6081
  const deserializeAws_json1_1ListOfKeyPhrases = (output, context) => {
5917
6082
  const retVal = (output || [])
5918
6083
  .filter((e) => e != null)
@@ -5968,6 +6133,17 @@ const deserializeAws_json1_1ListOfPiiEntityTypes = (output, context) => {
5968
6133
  });
5969
6134
  return retVal;
5970
6135
  };
6136
+ const deserializeAws_json1_1ListOfRelationships = (output, context) => {
6137
+ const retVal = (output || [])
6138
+ .filter((e) => e != null)
6139
+ .map((entry) => {
6140
+ if (entry === null) {
6141
+ return null;
6142
+ }
6143
+ return deserializeAws_json1_1RelationshipsListItem(entry, context);
6144
+ });
6145
+ return retVal;
6146
+ };
5971
6147
  const deserializeAws_json1_1ListOfSyntaxTokens = (output, context) => {
5972
6148
  const retVal = (output || [])
5973
6149
  .filter((e) => e != null)
@@ -6094,6 +6270,23 @@ const deserializeAws_json1_1PiiOutputDataConfig = (output, context) => {
6094
6270
  S3Uri: __expectString(output.S3Uri),
6095
6271
  };
6096
6272
  };
6273
+ const deserializeAws_json1_1Point = (output, context) => {
6274
+ return {
6275
+ X: __limitedParseFloat32(output.X),
6276
+ Y: __limitedParseFloat32(output.Y),
6277
+ };
6278
+ };
6279
+ const deserializeAws_json1_1Polygon = (output, context) => {
6280
+ const retVal = (output || [])
6281
+ .filter((e) => e != null)
6282
+ .map((entry) => {
6283
+ if (entry === null) {
6284
+ return null;
6285
+ }
6286
+ return deserializeAws_json1_1Point(entry, context);
6287
+ });
6288
+ return retVal;
6289
+ };
6097
6290
  const deserializeAws_json1_1PutResourcePolicyResponse = (output, context) => {
6098
6291
  return {
6099
6292
  PolicyRevisionId: __expectString(output.PolicyRevisionId),
@@ -6108,6 +6301,12 @@ const deserializeAws_json1_1RedactionConfig = (output, context) => {
6108
6301
  : undefined,
6109
6302
  };
6110
6303
  };
6304
+ const deserializeAws_json1_1RelationshipsListItem = (output, context) => {
6305
+ return {
6306
+ Ids: output.Ids != null ? deserializeAws_json1_1StringList(output.Ids, context) : undefined,
6307
+ Type: __expectString(output.Type),
6308
+ };
6309
+ };
6111
6310
  const deserializeAws_json1_1ResourceInUseException = (output, context) => {
6112
6311
  return {
6113
6312
  Message: __expectString(output.Message),
@@ -6290,6 +6489,17 @@ const deserializeAws_json1_1StopTrainingDocumentClassifierResponse = (output, co
6290
6489
  const deserializeAws_json1_1StopTrainingEntityRecognizerResponse = (output, context) => {
6291
6490
  return {};
6292
6491
  };
6492
+ const deserializeAws_json1_1StringList = (output, context) => {
6493
+ const retVal = (output || [])
6494
+ .filter((e) => e != null)
6495
+ .map((entry) => {
6496
+ if (entry === null) {
6497
+ return null;
6498
+ }
6499
+ return __expectString(entry);
6500
+ });
6501
+ return retVal;
6502
+ };
6293
6503
  const deserializeAws_json1_1Subnets = (output, context) => {
6294
6504
  const retVal = (output || [])
6295
6505
  .filter((e) => e != null)
@@ -131,6 +131,15 @@ export declare class Comprehend extends ComprehendClient {
131
131
  /**
132
132
  * <p>Creates a new document classification request to analyze a single document in real-time,
133
133
  * using a previously created and trained custom model and an endpoint.</p>
134
+ * <p>You can input plain text or you can upload a single-page input document (text, PDF, Word, or image). </p>
135
+ * <p>If the system detects errors while processing a page in the input document,
136
+ * the API response includes an entry in <code>Errors</code> that describes the errors.</p>
137
+ * <p>If the system detects a document-level error in your input document, the API returns an
138
+ * <code>InvalidRequestException</code> error response.
139
+ * For details about this exception, see
140
+ * <a href="https://docs.aws.amazon.com/comprehend/latest/dg/idp-inputs-sync-err.html">
141
+ * Errors in semi-structured documents</a> in the Comprehend Developer Guide.
142
+ * </p>
134
143
  */
135
144
  classifyDocument(args: ClassifyDocumentCommandInput, options?: __HttpHandlerOptions): Promise<ClassifyDocumentCommandOutput>;
136
145
  classifyDocument(args: ClassifyDocumentCommandInput, cb: (err: any, data?: ClassifyDocumentCommandOutput) => void): void;
@@ -306,9 +315,22 @@ export declare class Comprehend extends ComprehendClient {
306
315
  detectDominantLanguage(args: DetectDominantLanguageCommandInput, cb: (err: any, data?: DetectDominantLanguageCommandOutput) => void): void;
307
316
  detectDominantLanguage(args: DetectDominantLanguageCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: DetectDominantLanguageCommandOutput) => void): void;
308
317
  /**
309
- * <p>Inspects text for named entities, and returns information about them. For more
310
- * information, about named entities, see
318
+ * <p>Detects named entities in input text when you use the pre-trained model.
319
+ * Detects custom entities if you have a custom entity recognition model. </p>
320
+ * <p>
321
+ * When detecting named entities using the pre-trained model, use plain text as the input.
322
+ * For more information about named entities, see
311
323
  * <a href="https://docs.aws.amazon.com/comprehend/latest/dg/how-entities.html">Entities</a> in the Comprehend Developer Guide.</p>
324
+ * <p>When you use a custom entity recognition model,
325
+ * you can input plain text or you can upload a single-page input document (text, PDF, Word, or image). </p>
326
+ * <p>If the system detects errors while processing a page in the input document, the API response
327
+ * includes an entry in <code>Errors</code> for each error. </p>
328
+ * <p>If the system detects a document-level error in your input document, the API returns an
329
+ * <code>InvalidRequestException</code> error response.
330
+ * For details about this exception, see
331
+ * <a href="https://docs.aws.amazon.com/comprehend/latest/dg/idp-inputs-sync-err.html">
332
+ * Errors in semi-structured documents</a> in the Comprehend Developer Guide.
333
+ * </p>
312
334
  */
313
335
  detectEntities(args: DetectEntitiesCommandInput, options?: __HttpHandlerOptions): Promise<DetectEntitiesCommandOutput>;
314
336
  detectEntities(args: DetectEntitiesCommandInput, cb: (err: any, data?: DetectEntitiesCommandOutput) => void): void;
@@ -10,6 +10,15 @@ export interface ClassifyDocumentCommandOutput extends ClassifyDocumentResponse,
10
10
  /**
11
11
  * <p>Creates a new document classification request to analyze a single document in real-time,
12
12
  * using a previously created and trained custom model and an endpoint.</p>
13
+ * <p>You can input plain text or you can upload a single-page input document (text, PDF, Word, or image). </p>
14
+ * <p>If the system detects errors while processing a page in the input document,
15
+ * the API response includes an entry in <code>Errors</code> that describes the errors.</p>
16
+ * <p>If the system detects a document-level error in your input document, the API returns an
17
+ * <code>InvalidRequestException</code> error response.
18
+ * For details about this exception, see
19
+ * <a href="https://docs.aws.amazon.com/comprehend/latest/dg/idp-inputs-sync-err.html">
20
+ * Errors in semi-structured documents</a> in the Comprehend Developer Guide.
21
+ * </p>
13
22
  * @example
14
23
  * Use a bare-bones client and the command you need to make an API call.
15
24
  * ```javascript
@@ -8,9 +8,22 @@ export interface DetectEntitiesCommandInput extends DetectEntitiesRequest {
8
8
  export interface DetectEntitiesCommandOutput extends DetectEntitiesResponse, __MetadataBearer {
9
9
  }
10
10
  /**
11
- * <p>Inspects text for named entities, and returns information about them. For more
12
- * information, about named entities, see
11
+ * <p>Detects named entities in input text when you use the pre-trained model.
12
+ * Detects custom entities if you have a custom entity recognition model. </p>
13
+ * <p>
14
+ * When detecting named entities using the pre-trained model, use plain text as the input.
15
+ * For more information about named entities, see
13
16
  * <a href="https://docs.aws.amazon.com/comprehend/latest/dg/how-entities.html">Entities</a> in the Comprehend Developer Guide.</p>
17
+ * <p>When you use a custom entity recognition model,
18
+ * you can input plain text or you can upload a single-page input document (text, PDF, Word, or image). </p>
19
+ * <p>If the system detects errors while processing a page in the input document, the API response
20
+ * includes an entry in <code>Errors</code> for each error. </p>
21
+ * <p>If the system detects a document-level error in your input document, the API returns an
22
+ * <code>InvalidRequestException</code> error response.
23
+ * For details about this exception, see
24
+ * <a href="https://docs.aws.amazon.com/comprehend/latest/dg/idp-inputs-sync-err.html">
25
+ * Errors in semi-structured documents</a> in the Comprehend Developer Guide.
26
+ * </p>
14
27
  * @example
15
28
  * Use a bare-bones client and the command you need to make an API call.
16
29
  * ```javascript
@@ -12,7 +12,7 @@ export declare const resolveClientEndpointParameters: <T>(options: T & ClientInp
12
12
  defaultSigningName: string;
13
13
  };
14
14
  export interface EndpointParameters extends __EndpointParameters {
15
- Region?: string;
15
+ Region: string;
16
16
  UseDualStack?: boolean;
17
17
  UseFIPS?: boolean;
18
18
  Endpoint?: string;