Skip to content

Commit 5c0d056

Browse files
author
awstools
committed
feat(client-comprehend): Comprehend now supports semi-structured documents (such as PDF files or image files) as inputs for custom analysis using the synchronous APIs (ClassifyDocument and DetectEntities).
1 parent cb94b0c commit 5c0d056

File tree

12 files changed

+2843
-989
lines changed

12 files changed

+2843
-989
lines changed

clients/client-comprehend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"@aws-sdk/util-defaults-mode-browser": "*",
4848
"@aws-sdk/util-defaults-mode-node": "*",
4949
"@aws-sdk/util-endpoints": "*",
50+
"@aws-sdk/util-retry": "*",
5051
"@aws-sdk/util-user-agent-browser": "*",
5152
"@aws-sdk/util-user-agent-node": "*",
5253
"@aws-sdk/util-utf8-browser": "*",

clients/client-comprehend/src/Comprehend.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,15 @@ export class Comprehend extends ComprehendClient {
574574
/**
575575
* <p>Creates a new document classification request to analyze a single document in real-time,
576576
* using a previously created and trained custom model and an endpoint.</p>
577+
* <p>You can input plain text or you can upload a single-page input document (text, PDF, Word, or image). </p>
578+
* <p>If the system detects errors while processing a page in the input document,
579+
* the API response includes an entry in <code>Errors</code> that describes the errors.</p>
580+
* <p>If the system detects a document-level error in your input document, the API returns an
581+
* <code>InvalidRequestException</code> error response.
582+
* For details about this exception, see
583+
* <a href="https://docs.aws.amazon.com/comprehend/latest/dg/idp-inputs-sync-err.html">
584+
* Errors in semi-structured documents</a> in the Comprehend Developer Guide.
585+
* </p>
577586
*/
578587
public classifyDocument(
579588
args: ClassifyDocumentCommandInput,
@@ -1349,9 +1358,22 @@ export class Comprehend extends ComprehendClient {
13491358
}
13501359

13511360
/**
1352-
* <p>Inspects text for named entities, and returns information about them. For more
1353-
* information, about named entities, see
1361+
* <p>Detects named entities in input text when you use the pre-trained model.
1362+
* Detects custom entities if you have a custom entity recognition model. </p>
1363+
* <p>
1364+
* When detecting named entities using the pre-trained model, use plain text as the input.
1365+
* For more information about named entities, see
13541366
* <a href="https://docs.aws.amazon.com/comprehend/latest/dg/how-entities.html">Entities</a> in the Comprehend Developer Guide.</p>
1367+
* <p>When you use a custom entity recognition model,
1368+
* you can input plain text or you can upload a single-page input document (text, PDF, Word, or image). </p>
1369+
* <p>If the system detects errors while processing a page in the input document, the API response
1370+
* includes an entry in <code>Errors</code> for each error. </p>
1371+
* <p>If the system detects a document-level error in your input document, the API returns an
1372+
* <code>InvalidRequestException</code> error response.
1373+
* For details about this exception, see
1374+
* <a href="https://docs.aws.amazon.com/comprehend/latest/dg/idp-inputs-sync-err.html">
1375+
* Errors in semi-structured documents</a> in the Comprehend Developer Guide.
1376+
* </p>
13551377
*/
13561378
public detectEntities(
13571379
args: DetectEntitiesCommandInput,

clients/client-comprehend/src/commands/ClassifyDocumentCommand.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ export interface ClassifyDocumentCommandOutput extends ClassifyDocumentResponse,
3131
/**
3232
* <p>Creates a new document classification request to analyze a single document in real-time,
3333
* using a previously created and trained custom model and an endpoint.</p>
34+
* <p>You can input plain text or you can upload a single-page input document (text, PDF, Word, or image). </p>
35+
* <p>If the system detects errors while processing a page in the input document,
36+
* the API response includes an entry in <code>Errors</code> that describes the errors.</p>
37+
* <p>If the system detects a document-level error in your input document, the API returns an
38+
* <code>InvalidRequestException</code> error response.
39+
* For details about this exception, see
40+
* <a href="https://docs.aws.amazon.com/comprehend/latest/dg/idp-inputs-sync-err.html">
41+
* Errors in semi-structured documents</a> in the Comprehend Developer Guide.
42+
* </p>
3443
* @example
3544
* Use a bare-bones client and the command you need to make an API call.
3645
* ```javascript

clients/client-comprehend/src/commands/DetectEntitiesCommand.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,22 @@ export interface DetectEntitiesCommandInput extends DetectEntitiesRequest {}
2929
export interface DetectEntitiesCommandOutput extends DetectEntitiesResponse, __MetadataBearer {}
3030

3131
/**
32-
* <p>Inspects text for named entities, and returns information about them. For more
33-
* information, about named entities, see
32+
* <p>Detects named entities in input text when you use the pre-trained model.
33+
* Detects custom entities if you have a custom entity recognition model. </p>
34+
* <p>
35+
* When detecting named entities using the pre-trained model, use plain text as the input.
36+
* For more information about named entities, see
3437
* <a href="https://docs.aws.amazon.com/comprehend/latest/dg/how-entities.html">Entities</a> in the Comprehend Developer Guide.</p>
38+
* <p>When you use a custom entity recognition model,
39+
* you can input plain text or you can upload a single-page input document (text, PDF, Word, or image). </p>
40+
* <p>If the system detects errors while processing a page in the input document, the API response
41+
* includes an entry in <code>Errors</code> for each error. </p>
42+
* <p>If the system detects a document-level error in your input document, the API returns an
43+
* <code>InvalidRequestException</code> error response.
44+
* For details about this exception, see
45+
* <a href="https://docs.aws.amazon.com/comprehend/latest/dg/idp-inputs-sync-err.html">
46+
* Errors in semi-structured documents</a> in the Comprehend Developer Guide.
47+
* </p>
3548
* @example
3649
* Use a bare-bones client and the command you need to make an API call.
3750
* ```javascript

clients/client-comprehend/src/endpoint/EndpointParameters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const resolveClientEndpointParameters = <T>(
2424
};
2525

2626
export interface EndpointParameters extends __EndpointParameters {
27-
Region?: string;
27+
Region: string;
2828
UseDualStack?: boolean;
2929
UseFIPS?: boolean;
3030
Endpoint?: string;

clients/client-comprehend/src/endpoint/ruleset.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const ruleSet: RuleSetObject = {
66
parameters: {
77
Region: {
88
builtIn: "AWS::Region",
9-
required: false,
9+
required: true,
1010
documentation: "The AWS region used to dispatch the request.",
1111
type: "String",
1212
},

0 commit comments

Comments
 (0)