Class: AWS.Textract
- Inherits:
-
AWS.Service
- Object
- AWS.Service
- AWS.Textract
- Identifier:
- textract
- API Version:
- 2018-06-27
- Defined in:
- (unknown)
Overview
Constructs a service interface object. Each API operation is exposed as a function on service.
Service Description
Amazon Textract detects and analyzes text in documents and converts it into machine-readable text. This is the API reference documentation for Amazon Textract.
Sending a Request Using Textract
var textract = new AWS.Textract();
textract.analyzeDocument(params, function (err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Locking the API Version
In order to ensure that the Textract object uses this specific API, you can
construct the object by passing the apiVersion
option to the constructor:
var textract = new AWS.Textract({apiVersion: '2018-06-27'});
You can also set the API version globally in AWS.config.apiVersions
using
the textract service identifier:
AWS.config.apiVersions = {
textract: '2018-06-27',
// other service API versions
};
var textract = new AWS.Textract();
Version:
-
2018-06-27
Constructor Summary collapse
-
new AWS.Textract(options = {}) ⇒ Object
constructor
Constructs a service object.
Property Summary collapse
-
endpoint ⇒ AWS.Endpoint
readwrite
An Endpoint object representing the endpoint URL for service requests.
Properties inherited from AWS.Service
Method Summary collapse
-
analyzeDocument(params = {}, callback) ⇒ AWS.Request
Analyzes an input document for relationships between detected items.
-
analyzeExpense(params = {}, callback) ⇒ AWS.Request
AnalyzeExpense
synchronously analyzes an input document for financially related relationships between text.Information is returned as
ExpenseDocuments
and seperated as follows:-
LineItemGroups
- A data set containingLineItems
which store information about the lines of text, such as an item purchased and its price on a receipt. -
SummaryFields
- Contains all other information a receipt, such as header information or the vendors name.
-
-
analyzeID(params = {}, callback) ⇒ AWS.Request
Analyzes identity documents for relevant information.
-
createAdapter(params = {}, callback) ⇒ AWS.Request
Creates an adapter, which can be fine-tuned for enhanced performance on user provided documents.
-
createAdapterVersion(params = {}, callback) ⇒ AWS.Request
Creates a new version of an adapter.
-
deleteAdapter(params = {}, callback) ⇒ AWS.Request
Deletes an Amazon Textract adapter.
-
deleteAdapterVersion(params = {}, callback) ⇒ AWS.Request
Deletes an Amazon Textract adapter version.
-
detectDocumentText(params = {}, callback) ⇒ AWS.Request
Detects text in the input document.
-
getAdapter(params = {}, callback) ⇒ AWS.Request
Gets configuration information for an adapter specified by an AdapterId, returning information on AdapterName, Description, CreationTime, AutoUpdate status, and FeatureTypes.
.
-
getAdapterVersion(params = {}, callback) ⇒ AWS.Request
Gets configuration information for the specified adapter version, including: AdapterId, AdapterVersion, FeatureTypes, Status, StatusMessage, DatasetConfig, KMSKeyId, OutputConfig, Tags and EvaluationMetrics.
.
-
getDocumentAnalysis(params = {}, callback) ⇒ AWS.Request
Gets the results for an Amazon Textract asynchronous operation that analyzes text in a document.
You start asynchronous text analysis by calling StartDocumentAnalysis, which returns a job identifier (
JobId
). -
getDocumentTextDetection(params = {}, callback) ⇒ AWS.Request
Gets the results for an Amazon Textract asynchronous operation that detects text in a document.
-
getExpenseAnalysis(params = {}, callback) ⇒ AWS.Request
Gets the results for an Amazon Textract asynchronous operation that analyzes invoices and receipts.
-
getLendingAnalysis(params = {}, callback) ⇒ AWS.Request
Gets the results for an Amazon Textract asynchronous operation that analyzes text in a lending document.
-
getLendingAnalysisSummary(params = {}, callback) ⇒ AWS.Request
Gets summarized results for the
StartLendingAnalysis
operation, which analyzes text in a lending document. -
listAdapters(params = {}, callback) ⇒ AWS.Request
Lists all adapters that match the specified filtration criteria.
.
-
listAdapterVersions(params = {}, callback) ⇒ AWS.Request
List all version of an adapter that meet the specified filtration criteria.
.
-
listTagsForResource(params = {}, callback) ⇒ AWS.Request
Lists all tags for an Amazon Textract resource.
.
-
startDocumentAnalysis(params = {}, callback) ⇒ AWS.Request
Starts the asynchronous analysis of an input document for relationships between detected items such as key-value pairs, tables, and selection elements.
StartDocumentAnalysis
can analyze text in documents that are in JPEG, PNG, TIFF, and PDF format. -
startDocumentTextDetection(params = {}, callback) ⇒ AWS.Request
Starts the asynchronous detection of text in a document.
-
startExpenseAnalysis(params = {}, callback) ⇒ AWS.Request
Starts the asynchronous analysis of invoices or receipts for data like contact information, items purchased, and vendor names.
StartExpenseAnalysis
can analyze text in documents that are in JPEG, PNG, and PDF format. -
startLendingAnalysis(params = {}, callback) ⇒ AWS.Request
Starts the classification and analysis of an input document.
-
tagResource(params = {}, callback) ⇒ AWS.Request
Adds one or more tags to the specified resource.
.
-
untagResource(params = {}, callback) ⇒ AWS.Request
Removes any tags with the specified keys from the specified resource.
.
-
updateAdapter(params = {}, callback) ⇒ AWS.Request
Update the configuration for an adapter.
Methods inherited from AWS.Service
makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService
Constructor Details
new AWS.Textract(options = {}) ⇒ Object
Constructs a service object. This object has one method for each API operation.
Examples:
Constructing a Textract object
var textract = new AWS.Textract({apiVersion: '2018-06-27'});
Options Hash (options):
-
params
(map)
—
An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.
-
endpoint
(String|AWS.Endpoint)
—
The endpoint URI to send requests to. The default endpoint is built from the configured
region
. The endpoint should be a string like'https://{service}.{region}.amazonaws.com'
or an Endpoint object. -
accessKeyId
(String)
—
your AWS access key ID.
-
secretAccessKey
(String)
—
your AWS secret access key.
-
sessionToken
(AWS.Credentials)
—
the optional AWS session token to sign requests with.
-
credentials
(AWS.Credentials)
—
the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.
-
credentialProvider
(AWS.CredentialProviderChain)
—
the provider chain used to resolve credentials if no static
credentials
property is set. -
region
(String)
—
the region to send service requests to. See AWS.Textract.region for more information.
-
maxRetries
(Integer)
—
the maximum amount of retries to attempt with a request. See AWS.Textract.maxRetries for more information.
-
maxRedirects
(Integer)
—
the maximum amount of redirects to follow with a request. See AWS.Textract.maxRedirects for more information.
-
sslEnabled
(Boolean)
—
whether to enable SSL for requests.
-
paramValidation
(Boolean|map)
—
whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:
- min [Boolean] — Validates that a value meets the min
constraint. This is enabled by default when paramValidation is set
to
true
. - max [Boolean] — Validates that a value meets the max constraint.
- pattern [Boolean] — Validates that a string value matches a regular expression.
- enum [Boolean] — Validates that a string value matches one of the allowable enum values.
- min [Boolean] — Validates that a value meets the min
constraint. This is enabled by default when paramValidation is set
to
-
computeChecksums
(Boolean)
—
whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)
-
convertResponseTypes
(Boolean)
—
whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to
true
. -
correctClockSkew
(Boolean)
—
whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to
false
. -
s3ForcePathStyle
(Boolean)
—
whether to force path style URLs for S3 objects.
-
s3BucketEndpoint
(Boolean)
—
whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an
endpoint
to be provided explicitly to the service constructor. -
s3DisableBodySigning
(Boolean)
—
whether S3 body signing should be disabled when using signature version
v4
. Body signing can only be disabled when using https. Defaults totrue
. -
s3UsEast1RegionalEndpoint
('legacy'|'regional')
—
when region is set to 'us-east-1', whether to send s3 request to global endpoints or 'us-east-1' regional endpoints. This config is only applicable to S3 client. Defaults to
legacy
-
s3UseArnRegion
(Boolean)
—
whether to override the request region with the region inferred from requested resource's ARN. Only available for S3 buckets Defaults to
true
-
retryDelayOptions
(map)
—
A set of options to configure the retry delay on retryable errors. Currently supported options are:
- base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
- customBackoff [function] — A custom function that accepts a
retry count and error and returns the amount of time to delay in
milliseconds. If the result is a non-zero negative value, no further
retry attempts will be made. The
base
option will be ignored if this option is supplied. The function is only called for retryable errors.
-
httpOptions
(map)
—
A set of options to pass to the low-level HTTP request. Currently supported options are:
- proxy [String] — the URL to proxy requests through
- agent [http.Agent, https.Agent] — the Agent object to perform
HTTP requests with. Used for connection pooling. Defaults to the global
agent (
http.globalAgent
) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment. - connectTimeout [Integer] — Sets the socket to timeout after
failing to establish a connection with the server after
connectTimeout
milliseconds. This timeout has no effect once a socket connection has been established. - timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
- xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
- xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
-
apiVersion
(String, Date)
—
a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by
apiVersions
). Specify 'latest' to use the latest possible version. -
apiVersions
(map<String, String|Date>)
—
a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.
-
logger
(#write, #log)
—
an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests
-
systemClockOffset
(Number)
—
an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global
AWS.config
object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds. -
signatureVersion
(String)
—
the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.
-
signatureCache
(Boolean)
—
whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to
true
. -
dynamoDbCrc32
(Boolean)
—
whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default:
true
. -
useAccelerateEndpoint
(Boolean)
—
Whether to use the S3 Transfer Acceleration endpoint with the S3 service. Default:
false
. -
clientSideMonitoring
(Boolean)
—
whether to collect and publish this client's performance metrics of all its API requests.
-
endpointDiscoveryEnabled
(Boolean|undefined)
—
whether to call operations with endpoints given by service dynamically. Setting this
-
endpointCacheSize
(Number)
—
the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000
-
hostPrefixEnabled
(Boolean)
—
whether to marshal request parameters to the prefix of hostname. Defaults to
true
. -
stsRegionalEndpoints
('legacy'|'regional')
—
whether to send sts request to global endpoints or regional endpoints. Defaults to 'legacy'.
-
useFipsEndpoint
(Boolean)
—
Enables FIPS compatible endpoints. Defaults to
false
. -
useDualstackEndpoint
(Boolean)
—
Enables IPv6 dualstack endpoint. Defaults to
false
.
Property Details
Method Details
analyzeDocument(params = {}, callback) ⇒ AWS.Request
Analyzes an input document for relationships between detected items.
The types of information returned are as follows:
-
Form data (key-value pairs). The related information is returned in two Block objects, each of type
KEY_VALUE_SET
: a KEYBlock
object and a VALUEBlock
object. For example, Name: Ana Silva Carolina contains a key and value. Name: is the key. Ana Silva Carolina is the value. -
Table and table cell data. A TABLE
Block
object contains information about a detected table. A CELLBlock
object is returned for each cell in a table. -
Lines and words of text. A LINE
Block
object contains one or more WORDBlock
objects. All lines and words that are detected in the document are returned (including text that doesn't have a relationship with the value ofFeatureTypes
). -
Signatures. A SIGNATURE
Block
object contains the location information of a signature in a document. If used in conjunction with forms or tables, a signature can be given a Key-Value pairing or be detected in the cell of a table. -
Query. A QUERY Block object contains the query text, alias and link to the associated Query results block object.
-
Query Result. A QUERY_RESULT Block object contains the answer to the query and an ID that connects it to the query asked. This Block also contains a confidence score.
Selection elements such as check boxes and option buttons (radio buttons) can be detected in form data and in tables. A SELECTION_ELEMENT Block
object contains information about a selection element, including the selection status.
You can choose which type of analysis to perform by specifying the FeatureTypes
list.
The output is returned in a list of Block
objects.
AnalyzeDocument
is a synchronous operation. To analyze documents asynchronously, use StartDocumentAnalysis.
For more information, see Document Text Analysis.
Service Reference:
Examples:
Calling the analyzeDocument operation
var params = {
Document: { /* required */
Bytes: Buffer.from('...') || 'STRING_VALUE' /* Strings will be Base-64 encoded on your behalf */,
S3Object: {
Bucket: 'STRING_VALUE',
Name: 'STRING_VALUE',
Version: 'STRING_VALUE'
}
},
FeatureTypes: [ /* required */
TABLES | FORMS | QUERIES | SIGNATURES | LAYOUT,
/* more items */
],
AdaptersConfig: {
Adapters: [ /* required */
{
AdapterId: 'STRING_VALUE', /* required */
Version: 'STRING_VALUE', /* required */
Pages: [
'STRING_VALUE',
/* more items */
]
},
/* more items */
]
},
HumanLoopConfig: {
FlowDefinitionArn: 'STRING_VALUE', /* required */
HumanLoopName: 'STRING_VALUE', /* required */
DataAttributes: {
ContentClassifiers: [
FreeOfPersonallyIdentifiableInformation | FreeOfAdultContent,
/* more items */
]
}
},
QueriesConfig: {
Queries: [ /* required */
{
Text: 'STRING_VALUE', /* required */
Alias: 'STRING_VALUE',
Pages: [
'STRING_VALUE',
/* more items */
]
},
/* more items */
]
}
};
textract.analyzeDocument(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
Document
— (map
)The input document as base64-encoded bytes or an Amazon S3 object. If you use the AWS CLI to call Amazon Textract operations, you can't pass image bytes. The document must be an image in JPEG, PNG, PDF, or TIFF format.
If you're using an AWS SDK to call Amazon Textract, you might not need to base64-encode image bytes that are passed using the
Bytes
field.Bytes
— (Buffer, Typed Array, Blob, String
)A blob of base64-encoded document 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 JPEG format.
If you're using an AWS SDK to call Amazon Textract, you might not need to base64-encode image bytes passed using the
Bytes
field.S3Object
— (map
)Identifies an S3 object as the document source. The maximum size of a document that's stored in an S3 bucket is 5 MB.
Bucket
— (String
)The name of the S3 bucket. Note that the # character is not valid in the file name.
Name
— (String
)The file name of the input document. Synchronous operations can use image files that are in JPEG or PNG format. Asynchronous operations also support PDF and TIFF format files.
Version
— (String
)If the bucket has versioning enabled, you can specify the object version.
FeatureTypes
— (Array<String>
)A list of the types of analysis to perform. Add TABLES to the list to return information about the tables that are detected in the input document. Add FORMS to return detected form data. Add SIGNATURES to return the locations of detected signatures. Add LAYOUT to the list to return information about the layout of the document. All lines and words detected in the document are included in the response (including text that isn't related to the value of
FeatureTypes
).HumanLoopConfig
— (map
)Sets the configuration for the human in the loop workflow for analyzing documents.
HumanLoopName
— required — (String
)The name of the human workflow used for this image. This should be kept unique within a region.
FlowDefinitionArn
— required — (String
)The Amazon Resource Name (ARN) of the flow definition.
DataAttributes
— (map
)Sets attributes of the input data.
ContentClassifiers
— (Array<String>
)Sets whether the input image is free of personally identifiable information or adult content.
QueriesConfig
— (map
)Contains Queries and the alias for those Queries, as determined by the input.
Queries
— required — (Array<map>
)Text
— required — (String
)Question that Amazon Textract will apply to the document. An example would be "What is the customer's SSN?"
Alias
— (String
)Alias attached to the query, for ease of location.
Pages
— (Array<String>
)Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter.
-
If a page is not specified, it is set to
["1"]
by default. -
The following characters are allowed in the parameter's string:
0 1 2 3 4 5 6 7 8 9 - *
. No whitespace is allowed. -
When using * to indicate all pages, it must be the only element in the list.
-
You can use page intervals, such as
[“1-3”, “1-1”, “4-*”]
. Where*
indicates last page of document. -
Specified pages must be greater than 0 and less than or equal to the number of pages in the document.
-
AdaptersConfig
— (map
)Specifies the adapter to be used when analyzing a document.
Adapters
— required — (Array<map>
)A list of adapters to be used when analyzing the specified document.
AdapterId
— required — (String
)A unique identifier for the adapter resource.
Pages
— (Array<String>
)Pages is a parameter that the user inputs to specify which pages to apply an adapter to. The following is a list of rules for using this parameter.
-
If a page is not specified, it is set to
["1"]
by default. -
The following characters are allowed in the parameter's string:
0 1 2 3 4 5 6 7 8 9 - *
. No whitespace is allowed. -
When using * to indicate all pages, it must be the only element in the list.
-
You can use page intervals, such as
["1-3", "1-1", "4-*"]
. Where*
indicates last page of document. -
Specified pages must be greater than 0 and less than or equal to the number of pages in the document.
-
Version
— required — (String
)A string that identifies the version of the adapter.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:DocumentMetadata
— (map
)Metadata about the analyzed document. An example is the number of pages.
Pages
— (Integer
)The number of pages that are detected in the document.
Blocks
— (Array<map>
)The items that are detected and analyzed by
AnalyzeDocument
.BlockType
— (String
)The type of text item that's recognized. In operations for text detection, the following types are returned:
-
PAGE - Contains a list of the LINE
Block
objects that are detected on a document page. -
WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
In text analysis operations, the following types are returned:
-
PAGE - Contains a list of child
Block
objects that are detected on a document page. -
KEY_VALUE_SET - Stores the KEY and VALUE
Block
objects for linked text that's detected on a document page. Use theEntityType
field to determine if a KEY_VALUE_SET object is a KEYBlock
object or a VALUEBlock
object. -
WORD - A word that's detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
-
TABLE - A table that's detected on a document page. A table is grid-based information with two or more rows or columns, with a cell span of one row and one column each.
-
TABLE_TITLE - The title of a table. A title is typically a line of text above or below a table, or embedded as the first row of a table.
-
TABLE_FOOTER - The footer associated with a table. A footer is typically a line or lines of text below a table or embedded as the last row of a table.
-
CELL - A cell within a detected table. The cell is the parent of the block that contains the text in the cell.
-
MERGED_CELL - A cell in a table whose content spans more than one row or column. The
Relationships
array for this cell contain data from individual cells. -
SELECTION_ELEMENT - A selection element such as an option button (radio button) or a check box that's detected on a document page. Use the value of
SelectionStatus
to determine the status of the selection element. -
SIGNATURE - The location and confidence score of a signature detected on a document page. Can be returned as part of a Key-Value pair or a detected cell.
-
QUERY - A question asked during the call of AnalyzeDocument. Contains an alias and an ID that attaches it to its answer.
-
QUERY_RESULT - A response to a question asked during the call of analyze document. Comes with an alias and ID for ease of locating in a response. Also contains location and confidence score.
The following BlockTypes are only returned for Amazon Textract Layout.
-
LAYOUT_TITLE
- The main title of the document. -
LAYOUT_HEADER
- Text located in the top margin of the document. -
LAYOUT_FOOTER
- Text located in the bottom margin of the document. -
LAYOUT_SECTION_HEADER
- The titles of sections within a document. -
LAYOUT_PAGE_NUMBER
- The page number of the documents. -
LAYOUT_LIST
- Any information grouped together in list form. -
LAYOUT_FIGURE
- Indicates the location of an image in a document. -
LAYOUT_TABLE
- Indicates the location of a table in the document. -
LAYOUT_KEY_VALUE
- Indicates the location of form key-values in a document. -
LAYOUT_TEXT
- Text that is present typically as a part of paragraphs in documents.
"KEY_VALUE_SET"
"PAGE"
"LINE"
"WORD"
"TABLE"
"CELL"
"SELECTION_ELEMENT"
"MERGED_CELL"
"TITLE"
"QUERY"
"QUERY_RESULT"
"SIGNATURE"
"TABLE_TITLE"
"TABLE_FOOTER"
"LAYOUT_TEXT"
"LAYOUT_TITLE"
"LAYOUT_HEADER"
"LAYOUT_FOOTER"
"LAYOUT_SECTION_HEADER"
"LAYOUT_PAGE_NUMBER"
"LAYOUT_LIST"
"LAYOUT_FIGURE"
"LAYOUT_TABLE"
"LAYOUT_KEY_VALUE"
-
Confidence
— (Float
)The confidence score that Amazon Textract has in the accuracy of the recognized text and the accuracy of the geometry points around the recognized text.
Text
— (String
)The word or line of text that's recognized by Amazon Textract.
TextType
— (String
)The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
Possible values include:"HANDWRITING"
"PRINTED"
RowIndex
— (Integer
)The row in which a table cell is located. The first row position is 1.
RowIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnIndex
— (Integer
)The column in which a table cell appears. The first column position is 1.
ColumnIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.RowSpan
— (Integer
)The number of rows that a table cell spans.
RowSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnSpan
— (Integer
)The number of columns that a table cell spans.
ColumnSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.Geometry
— (map
)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.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Id
— (String
)The identifier for the recognized text. The identifier is only unique for a single operation.
Relationships
— (Array<map>
)A list of relationship objects that describe how blocks are related to each other. For example, a LINE block object contains a CHILD relationship type with the WORD blocks that make up 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.
Type
— (String
)The type of relationship between the blocks in the IDs array and the current block. The following list describes the relationship types that can be returned.
-
VALUE - A list that contains the ID of the VALUE block that's associated with the KEY of a key-value pair.
-
CHILD - A list of IDs that identify blocks found within the current block object. For example, WORD blocks have a CHILD relationship to the LINE block type.
-
MERGED_CELL - A list of IDs that identify each of the MERGED_CELL block types in a table.
-
ANSWER - A list that contains the ID of the QUERY_RESULT block that’s associated with the corresponding QUERY block.
-
TABLE - A list of IDs that identify associated TABLE block types.
-
TABLE_TITLE - A list that contains the ID for the TABLE_TITLE block type in a table.
-
TABLE_FOOTER - A list of IDs that identify the TABLE_FOOTER block types in a table.
"VALUE"
"CHILD"
"COMPLEX_FEATURES"
"MERGED_CELL"
"TITLE"
"ANSWER"
"TABLE"
"TABLE_TITLE"
"TABLE_FOOTER"
-
Ids
— (Array<String>
)An array of IDs for related blocks. You can get the type of the relationship from the
Type
element.
EntityTypes
— (Array<String>
)The type of entity.
The following entity types can be returned by FORMS analysis:
-
KEY - An identifier for a field on the document.
-
VALUE - The field text.
The following entity types can be returned by TABLES analysis:
-
COLUMN_HEADER - Identifies a cell that is a header of a column.
-
TABLE_TITLE - Identifies a cell that is a title within the table.
-
TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section title is a cell that typically spans an entire row above a section.
-
TABLE_FOOTER - Identifies a cell that is a footer of a table.
-
TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an additional, smaller table that contains summary information for another table.
-
STRUCTURED_TABLE - Identifies a table with column headers where the content of each row corresponds to the headers.
-
SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
EntityTypes
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.-
SelectionStatus
— (String
)The selection status of a selection element, such as an option button or check box.
Possible values include:"SELECTED"
"NOT_SELECTED"
Page
— (Integer
)The page on which a block was detected.
Page
is returned by synchronous and asynchronous operations. Page values greater than 1 are only returned for multipage documents that are in PDF or TIFF format. A scanned image (JPEG/PNG) provided to an asynchronous operation, even if it contains multiple document pages, is considered a single-page document. This means that for scanned images the value ofPage
is always 1.Query
— (map
)Text
— required — (String
)Question that Amazon Textract will apply to the document. An example would be "What is the customer's SSN?"
Alias
— (String
)Alias attached to the query, for ease of location.
Pages
— (Array<String>
)Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter.
-
If a page is not specified, it is set to
["1"]
by default. -
The following characters are allowed in the parameter's string:
0 1 2 3 4 5 6 7 8 9 - *
. No whitespace is allowed. -
When using * to indicate all pages, it must be the only element in the list.
-
You can use page intervals, such as
[“1-3”, “1-1”, “4-*”]
. Where*
indicates last page of document. -
Specified pages must be greater than 0 and less than or equal to the number of pages in the document.
-
HumanLoopActivationOutput
— (map
)Shows the results of the human in the loop evaluation.
HumanLoopArn
— (String
)The Amazon Resource Name (ARN) of the HumanLoop created.
HumanLoopActivationReasons
— (Array<String>
)Shows if and why human review was needed.
HumanLoopActivationConditionsEvaluationResults
— (String
)Shows the result of condition evaluations, including those conditions which activated a human review.
AnalyzeDocumentModelVersion
— (String
)The version of the model used to analyze the document.
-
(AWS.Response)
—
Returns:
analyzeExpense(params = {}, callback) ⇒ AWS.Request
AnalyzeExpense
synchronously analyzes an input document for financially related relationships between text.
Information is returned as ExpenseDocuments
and seperated as follows:
-
LineItemGroups
- A data set containingLineItems
which store information about the lines of text, such as an item purchased and its price on a receipt. -
SummaryFields
- Contains all other information a receipt, such as header information or the vendors name.
Service Reference:
Examples:
Calling the analyzeExpense operation
var params = {
Document: { /* required */
Bytes: Buffer.from('...') || 'STRING_VALUE' /* Strings will be Base-64 encoded on your behalf */,
S3Object: {
Bucket: 'STRING_VALUE',
Name: 'STRING_VALUE',
Version: 'STRING_VALUE'
}
}
};
textract.analyzeExpense(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
Document
— (map
)The input document, either as bytes or as an S3 object.
You pass image bytes to an Amazon Textract API operation by using the
Bytes
property. For example, you would use theBytes
property to pass a document loaded from a local file system. Image bytes passed by using theBytes
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.You pass images stored in an S3 bucket to an Amazon Textract API operation by using the
S3Object
property. Documents stored in an S3 bucket don't need to be base64 encoded.The AWS Region for the S3 bucket that contains the S3 object must match the AWS Region that you use for Amazon Textract operations.
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.
For Amazon Textract to process an S3 object, the user must have permission to access the S3 object.
Bytes
— (Buffer, Typed Array, Blob, String
)A blob of base64-encoded document 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 JPEG format.
If you're using an AWS SDK to call Amazon Textract, you might not need to base64-encode image bytes passed using the
Bytes
field.S3Object
— (map
)Identifies an S3 object as the document source. The maximum size of a document that's stored in an S3 bucket is 5 MB.
Bucket
— (String
)The name of the S3 bucket. Note that the # character is not valid in the file name.
Name
— (String
)The file name of the input document. Synchronous operations can use image files that are in JPEG or PNG format. Asynchronous operations also support PDF and TIFF format files.
Version
— (String
)If the bucket has versioning enabled, you can specify the object version.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:DocumentMetadata
— (map
)Information about the input document.
Pages
— (Integer
)The number of pages that are detected in the document.
ExpenseDocuments
— (Array<map>
)The expenses detected by Amazon Textract.
ExpenseIndex
— (Integer
)Denotes which invoice or receipt in the document the information is coming from. First document will be 1, the second 2, and so on.
SummaryFields
— (Array<map>
)Any information found outside of a table by Amazon Textract.
Type
— (map
)The implied label of a detected element. Present alongside LabelDetection for explicit elements.
Text
— (String
)The word or line of text detected by Amazon Textract.
Confidence
— (Float
)The confidence of accuracy, as a percentage.
LabelDetection
— (map
)The explicitly stated label of a detected element.
Text
— (String
)The word or line of text recognized by Amazon Textract
Geometry
— (map
)Information about where the following items are located on a document page: detected page, text, key-value pairs, tables, table cells, and selection elements.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Confidence
— (Float
)The confidence in detection, as a percentage
ValueDetection
— (map
)The value of a detected element. Present in explicit and implicit elements.
Text
— (String
)The word or line of text recognized by Amazon Textract
Geometry
— (map
)Information about where the following items are located on a document page: detected page, text, key-value pairs, tables, table cells, and selection elements.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Confidence
— (Float
)The confidence in detection, as a percentage
PageNumber
— (Integer
)The page number the value was detected on.
Currency
— (map
)Shows the kind of currency, both the code and confidence associated with any monatary value detected.
Code
— (String
)Currency code for detected currency. the current supported codes are:
-
USD
-
EUR
-
GBP
-
CAD
-
INR
-
JPY
-
CHF
-
AUD
-
CNY
-
BZR
-
SEK
-
HKD
-
Confidence
— (Float
)Percentage confideence in the detected currency.
GroupProperties
— (Array<map>
)Shows which group a response object belongs to, such as whether an address line belongs to the vendor's address or the recipent's address.
Types
— (Array<String>
)Informs you on whether the expense group is a name or an address.
Id
— (String
)Provides a group Id number, which will be the same for each in the group.
LineItemGroups
— (Array<map>
)Information detected on each table of a document, seperated into
LineItems
.LineItemGroupIndex
— (Integer
)The number used to identify a specific table in a document. The first table encountered will have a LineItemGroupIndex of 1, the second 2, etc.
LineItems
— (Array<map>
)The breakdown of information on a particular line of a table.
LineItemExpenseFields
— (Array<map>
)ExpenseFields used to show information from detected lines on a table.
Type
— (map
)The implied label of a detected element. Present alongside LabelDetection for explicit elements.
Text
— (String
)The word or line of text detected by Amazon Textract.
Confidence
— (Float
)The confidence of accuracy, as a percentage.
LabelDetection
— (map
)The explicitly stated label of a detected element.
Text
— (String
)The word or line of text recognized by Amazon Textract
Geometry
— (map
)Information about where the following items are located on a document page: detected page, text, key-value pairs, tables, table cells, and selection elements.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Confidence
— (Float
)The confidence in detection, as a percentage
ValueDetection
— (map
)The value of a detected element. Present in explicit and implicit elements.
Text
— (String
)The word or line of text recognized by Amazon Textract
Geometry
— (map
)Information about where the following items are located on a document page: detected page, text, key-value pairs, tables, table cells, and selection elements.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Confidence
— (Float
)The confidence in detection, as a percentage
PageNumber
— (Integer
)The page number the value was detected on.
Currency
— (map
)Shows the kind of currency, both the code and confidence associated with any monatary value detected.
Code
— (String
)Currency code for detected currency. the current supported codes are:
-
USD
-
EUR
-
GBP
-
CAD
-
INR
-
JPY
-
CHF
-
AUD
-
CNY
-
BZR
-
SEK
-
HKD
-
Confidence
— (Float
)Percentage confideence in the detected currency.
GroupProperties
— (Array<map>
)Shows which group a response object belongs to, such as whether an address line belongs to the vendor's address or the recipent's address.
Types
— (Array<String>
)Informs you on whether the expense group is a name or an address.
Id
— (String
)Provides a group Id number, which will be the same for each in the group.
Blocks
— (Array<map>
)This is a block object, the same as reported when DetectDocumentText is run on a document. It provides word level recognition of text.
BlockType
— (String
)The type of text item that's recognized. In operations for text detection, the following types are returned:
-
PAGE - Contains a list of the LINE
Block
objects that are detected on a document page. -
WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
In text analysis operations, the following types are returned:
-
PAGE - Contains a list of child
Block
objects that are detected on a document page. -
KEY_VALUE_SET - Stores the KEY and VALUE
Block
objects for linked text that's detected on a document page. Use theEntityType
field to determine if a KEY_VALUE_SET object is a KEYBlock
object or a VALUEBlock
object. -
WORD - A word that's detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
-
TABLE - A table that's detected on a document page. A table is grid-based information with two or more rows or columns, with a cell span of one row and one column each.
-
TABLE_TITLE - The title of a table. A title is typically a line of text above or below a table, or embedded as the first row of a table.
-
TABLE_FOOTER - The footer associated with a table. A footer is typically a line or lines of text below a table or embedded as the last row of a table.
-
CELL - A cell within a detected table. The cell is the parent of the block that contains the text in the cell.
-
MERGED_CELL - A cell in a table whose content spans more than one row or column. The
Relationships
array for this cell contain data from individual cells. -
SELECTION_ELEMENT - A selection element such as an option button (radio button) or a check box that's detected on a document page. Use the value of
SelectionStatus
to determine the status of the selection element. -
SIGNATURE - The location and confidence score of a signature detected on a document page. Can be returned as part of a Key-Value pair or a detected cell.
-
QUERY - A question asked during the call of AnalyzeDocument. Contains an alias and an ID that attaches it to its answer.
-
QUERY_RESULT - A response to a question asked during the call of analyze document. Comes with an alias and ID for ease of locating in a response. Also contains location and confidence score.
The following BlockTypes are only returned for Amazon Textract Layout.
-
LAYOUT_TITLE
- The main title of the document. -
LAYOUT_HEADER
- Text located in the top margin of the document. -
LAYOUT_FOOTER
- Text located in the bottom margin of the document. -
LAYOUT_SECTION_HEADER
- The titles of sections within a document. -
LAYOUT_PAGE_NUMBER
- The page number of the documents. -
LAYOUT_LIST
- Any information grouped together in list form. -
LAYOUT_FIGURE
- Indicates the location of an image in a document. -
LAYOUT_TABLE
- Indicates the location of a table in the document. -
LAYOUT_KEY_VALUE
- Indicates the location of form key-values in a document. -
LAYOUT_TEXT
- Text that is present typically as a part of paragraphs in documents.
"KEY_VALUE_SET"
"PAGE"
"LINE"
"WORD"
"TABLE"
"CELL"
"SELECTION_ELEMENT"
"MERGED_CELL"
"TITLE"
"QUERY"
"QUERY_RESULT"
"SIGNATURE"
"TABLE_TITLE"
"TABLE_FOOTER"
"LAYOUT_TEXT"
"LAYOUT_TITLE"
"LAYOUT_HEADER"
"LAYOUT_FOOTER"
"LAYOUT_SECTION_HEADER"
"LAYOUT_PAGE_NUMBER"
"LAYOUT_LIST"
"LAYOUT_FIGURE"
"LAYOUT_TABLE"
"LAYOUT_KEY_VALUE"
-
Confidence
— (Float
)The confidence score that Amazon Textract has in the accuracy of the recognized text and the accuracy of the geometry points around the recognized text.
Text
— (String
)The word or line of text that's recognized by Amazon Textract.
TextType
— (String
)The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
Possible values include:"HANDWRITING"
"PRINTED"
RowIndex
— (Integer
)The row in which a table cell is located. The first row position is 1.
RowIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnIndex
— (Integer
)The column in which a table cell appears. The first column position is 1.
ColumnIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.RowSpan
— (Integer
)The number of rows that a table cell spans.
RowSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnSpan
— (Integer
)The number of columns that a table cell spans.
ColumnSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.Geometry
— (map
)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.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Id
— (String
)The identifier for the recognized text. The identifier is only unique for a single operation.
Relationships
— (Array<map>
)A list of relationship objects that describe how blocks are related to each other. For example, a LINE block object contains a CHILD relationship type with the WORD blocks that make up 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.
Type
— (String
)The type of relationship between the blocks in the IDs array and the current block. The following list describes the relationship types that can be returned.
-
VALUE - A list that contains the ID of the VALUE block that's associated with the KEY of a key-value pair.
-
CHILD - A list of IDs that identify blocks found within the current block object. For example, WORD blocks have a CHILD relationship to the LINE block type.
-
MERGED_CELL - A list of IDs that identify each of the MERGED_CELL block types in a table.
-
ANSWER - A list that contains the ID of the QUERY_RESULT block that’s associated with the corresponding QUERY block.
-
TABLE - A list of IDs that identify associated TABLE block types.
-
TABLE_TITLE - A list that contains the ID for the TABLE_TITLE block type in a table.
-
TABLE_FOOTER - A list of IDs that identify the TABLE_FOOTER block types in a table.
"VALUE"
"CHILD"
"COMPLEX_FEATURES"
"MERGED_CELL"
"TITLE"
"ANSWER"
"TABLE"
"TABLE_TITLE"
"TABLE_FOOTER"
-
Ids
— (Array<String>
)An array of IDs for related blocks. You can get the type of the relationship from the
Type
element.
EntityTypes
— (Array<String>
)The type of entity.
The following entity types can be returned by FORMS analysis:
-
KEY - An identifier for a field on the document.
-
VALUE - The field text.
The following entity types can be returned by TABLES analysis:
-
COLUMN_HEADER - Identifies a cell that is a header of a column.
-
TABLE_TITLE - Identifies a cell that is a title within the table.
-
TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section title is a cell that typically spans an entire row above a section.
-
TABLE_FOOTER - Identifies a cell that is a footer of a table.
-
TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an additional, smaller table that contains summary information for another table.
-
STRUCTURED_TABLE - Identifies a table with column headers where the content of each row corresponds to the headers.
-
SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
EntityTypes
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.-
SelectionStatus
— (String
)The selection status of a selection element, such as an option button or check box.
Possible values include:"SELECTED"
"NOT_SELECTED"
Page
— (Integer
)The page on which a block was detected.
Page
is returned by synchronous and asynchronous operations. Page values greater than 1 are only returned for multipage documents that are in PDF or TIFF format. A scanned image (JPEG/PNG) provided to an asynchronous operation, even if it contains multiple document pages, is considered a single-page document. This means that for scanned images the value ofPage
is always 1.Query
— (map
)Text
— required — (String
)Question that Amazon Textract will apply to the document. An example would be "What is the customer's SSN?"
Alias
— (String
)Alias attached to the query, for ease of location.
Pages
— (Array<String>
)Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter.
-
If a page is not specified, it is set to
["1"]
by default. -
The following characters are allowed in the parameter's string:
0 1 2 3 4 5 6 7 8 9 - *
. No whitespace is allowed. -
When using * to indicate all pages, it must be the only element in the list.
-
You can use page intervals, such as
[“1-3”, “1-1”, “4-*”]
. Where*
indicates last page of document. -
Specified pages must be greater than 0 and less than or equal to the number of pages in the document.
-
-
(AWS.Response)
—
Returns:
analyzeID(params = {}, callback) ⇒ AWS.Request
Analyzes identity documents for relevant information. This information is extracted and returned as IdentityDocumentFields
, which records both the normalized field and value of the extracted text. Unlike other Amazon Textract operations, AnalyzeID
doesn't return any Geometry data.
Service Reference:
Examples:
Calling the analyzeID operation
var params = {
DocumentPages: [ /* required */
{
Bytes: Buffer.from('...') || 'STRING_VALUE' /* Strings will be Base-64 encoded on your behalf */,
S3Object: {
Bucket: 'STRING_VALUE',
Name: 'STRING_VALUE',
Version: 'STRING_VALUE'
}
},
/* more items */
]
};
textract.analyzeID(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
DocumentPages
— (Array<map>
)The document being passed to AnalyzeID.
Bytes
— (Buffer, Typed Array, Blob, String
)A blob of base64-encoded document 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 JPEG format.
If you're using an AWS SDK to call Amazon Textract, you might not need to base64-encode image bytes passed using the
Bytes
field.S3Object
— (map
)Identifies an S3 object as the document source. The maximum size of a document that's stored in an S3 bucket is 5 MB.
Bucket
— (String
)The name of the S3 bucket. Note that the # character is not valid in the file name.
Name
— (String
)The file name of the input document. Synchronous operations can use image files that are in JPEG or PNG format. Asynchronous operations also support PDF and TIFF format files.
Version
— (String
)If the bucket has versioning enabled, you can specify the object version.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:IdentityDocuments
— (Array<map>
)The list of documents processed by AnalyzeID. Includes a number denoting their place in the list and the response structure for the document.
DocumentIndex
— (Integer
)Denotes the placement of a document in the IdentityDocument list. The first document is marked 1, the second 2 and so on.
IdentityDocumentFields
— (Array<map>
)The structure used to record information extracted from identity documents. Contains both normalized field and value of the extracted text.
Type
— (map
)Used to contain the information detected by an AnalyzeID operation.
Text
— required — (String
)Text of either the normalized field or value associated with it.
NormalizedValue
— (map
)Only returned for dates, returns the type of value detected and the date written in a more machine readable way.
Value
— (String
)The value of the date, written as Year-Month-DayTHour:Minute:Second.
ValueType
— (String
)The normalized type of the value detected. In this case, DATE.
Possible values include:"DATE"
Confidence
— (Float
)The confidence score of the detected text.
ValueDetection
— (map
)Used to contain the information detected by an AnalyzeID operation.
Text
— required — (String
)Text of either the normalized field or value associated with it.
NormalizedValue
— (map
)Only returned for dates, returns the type of value detected and the date written in a more machine readable way.
Value
— (String
)The value of the date, written as Year-Month-DayTHour:Minute:Second.
ValueType
— (String
)The normalized type of the value detected. In this case, DATE.
Possible values include:"DATE"
Confidence
— (Float
)The confidence score of the detected text.
Blocks
— (Array<map>
)Individual word recognition, as returned by document detection.
BlockType
— (String
)The type of text item that's recognized. In operations for text detection, the following types are returned:
-
PAGE - Contains a list of the LINE
Block
objects that are detected on a document page. -
WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
In text analysis operations, the following types are returned:
-
PAGE - Contains a list of child
Block
objects that are detected on a document page. -
KEY_VALUE_SET - Stores the KEY and VALUE
Block
objects for linked text that's detected on a document page. Use theEntityType
field to determine if a KEY_VALUE_SET object is a KEYBlock
object or a VALUEBlock
object. -
WORD - A word that's detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
-
TABLE - A table that's detected on a document page. A table is grid-based information with two or more rows or columns, with a cell span of one row and one column each.
-
TABLE_TITLE - The title of a table. A title is typically a line of text above or below a table, or embedded as the first row of a table.
-
TABLE_FOOTER - The footer associated with a table. A footer is typically a line or lines of text below a table or embedded as the last row of a table.
-
CELL - A cell within a detected table. The cell is the parent of the block that contains the text in the cell.
-
MERGED_CELL - A cell in a table whose content spans more than one row or column. The
Relationships
array for this cell contain data from individual cells. -
SELECTION_ELEMENT - A selection element such as an option button (radio button) or a check box that's detected on a document page. Use the value of
SelectionStatus
to determine the status of the selection element. -
SIGNATURE - The location and confidence score of a signature detected on a document page. Can be returned as part of a Key-Value pair or a detected cell.
-
QUERY - A question asked during the call of AnalyzeDocument. Contains an alias and an ID that attaches it to its answer.
-
QUERY_RESULT - A response to a question asked during the call of analyze document. Comes with an alias and ID for ease of locating in a response. Also contains location and confidence score.
The following BlockTypes are only returned for Amazon Textract Layout.
-
LAYOUT_TITLE
- The main title of the document. -
LAYOUT_HEADER
- Text located in the top margin of the document. -
LAYOUT_FOOTER
- Text located in the bottom margin of the document. -
LAYOUT_SECTION_HEADER
- The titles of sections within a document. -
LAYOUT_PAGE_NUMBER
- The page number of the documents. -
LAYOUT_LIST
- Any information grouped together in list form. -
LAYOUT_FIGURE
- Indicates the location of an image in a document. -
LAYOUT_TABLE
- Indicates the location of a table in the document. -
LAYOUT_KEY_VALUE
- Indicates the location of form key-values in a document. -
LAYOUT_TEXT
- Text that is present typically as a part of paragraphs in documents.
"KEY_VALUE_SET"
"PAGE"
"LINE"
"WORD"
"TABLE"
"CELL"
"SELECTION_ELEMENT"
"MERGED_CELL"
"TITLE"
"QUERY"
"QUERY_RESULT"
"SIGNATURE"
"TABLE_TITLE"
"TABLE_FOOTER"
"LAYOUT_TEXT"
"LAYOUT_TITLE"
"LAYOUT_HEADER"
"LAYOUT_FOOTER"
"LAYOUT_SECTION_HEADER"
"LAYOUT_PAGE_NUMBER"
"LAYOUT_LIST"
"LAYOUT_FIGURE"
"LAYOUT_TABLE"
"LAYOUT_KEY_VALUE"
-
Confidence
— (Float
)The confidence score that Amazon Textract has in the accuracy of the recognized text and the accuracy of the geometry points around the recognized text.
Text
— (String
)The word or line of text that's recognized by Amazon Textract.
TextType
— (String
)The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
Possible values include:"HANDWRITING"
"PRINTED"
RowIndex
— (Integer
)The row in which a table cell is located. The first row position is 1.
RowIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnIndex
— (Integer
)The column in which a table cell appears. The first column position is 1.
ColumnIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.RowSpan
— (Integer
)The number of rows that a table cell spans.
RowSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnSpan
— (Integer
)The number of columns that a table cell spans.
ColumnSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.Geometry
— (map
)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.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Id
— (String
)The identifier for the recognized text. The identifier is only unique for a single operation.
Relationships
— (Array<map>
)A list of relationship objects that describe how blocks are related to each other. For example, a LINE block object contains a CHILD relationship type with the WORD blocks that make up 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.
Type
— (String
)The type of relationship between the blocks in the IDs array and the current block. The following list describes the relationship types that can be returned.
-
VALUE - A list that contains the ID of the VALUE block that's associated with the KEY of a key-value pair.
-
CHILD - A list of IDs that identify blocks found within the current block object. For example, WORD blocks have a CHILD relationship to the LINE block type.
-
MERGED_CELL - A list of IDs that identify each of the MERGED_CELL block types in a table.
-
ANSWER - A list that contains the ID of the QUERY_RESULT block that’s associated with the corresponding QUERY block.
-
TABLE - A list of IDs that identify associated TABLE block types.
-
TABLE_TITLE - A list that contains the ID for the TABLE_TITLE block type in a table.
-
TABLE_FOOTER - A list of IDs that identify the TABLE_FOOTER block types in a table.
"VALUE"
"CHILD"
"COMPLEX_FEATURES"
"MERGED_CELL"
"TITLE"
"ANSWER"
"TABLE"
"TABLE_TITLE"
"TABLE_FOOTER"
-
Ids
— (Array<String>
)An array of IDs for related blocks. You can get the type of the relationship from the
Type
element.
EntityTypes
— (Array<String>
)The type of entity.
The following entity types can be returned by FORMS analysis:
-
KEY - An identifier for a field on the document.
-
VALUE - The field text.
The following entity types can be returned by TABLES analysis:
-
COLUMN_HEADER - Identifies a cell that is a header of a column.
-
TABLE_TITLE - Identifies a cell that is a title within the table.
-
TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section title is a cell that typically spans an entire row above a section.
-
TABLE_FOOTER - Identifies a cell that is a footer of a table.
-
TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an additional, smaller table that contains summary information for another table.
-
STRUCTURED_TABLE - Identifies a table with column headers where the content of each row corresponds to the headers.
-
SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
EntityTypes
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.-
SelectionStatus
— (String
)The selection status of a selection element, such as an option button or check box.
Possible values include:"SELECTED"
"NOT_SELECTED"
Page
— (Integer
)The page on which a block was detected.
Page
is returned by synchronous and asynchronous operations. Page values greater than 1 are only returned for multipage documents that are in PDF or TIFF format. A scanned image (JPEG/PNG) provided to an asynchronous operation, even if it contains multiple document pages, is considered a single-page document. This means that for scanned images the value ofPage
is always 1.Query
— (map
)Text
— required — (String
)Question that Amazon Textract will apply to the document. An example would be "What is the customer's SSN?"
Alias
— (String
)Alias attached to the query, for ease of location.
Pages
— (Array<String>
)Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter.
-
If a page is not specified, it is set to
["1"]
by default. -
The following characters are allowed in the parameter's string:
0 1 2 3 4 5 6 7 8 9 - *
. No whitespace is allowed. -
When using * to indicate all pages, it must be the only element in the list.
-
You can use page intervals, such as
[“1-3”, “1-1”, “4-*”]
. Where*
indicates last page of document. -
Specified pages must be greater than 0 and less than or equal to the number of pages in the document.
-
DocumentMetadata
— (map
)Information about the input document.
Pages
— (Integer
)The number of pages that are detected in the document.
AnalyzeIDModelVersion
— (String
)The version of the AnalyzeIdentity API being used to process documents.
-
(AWS.Response)
—
Returns:
createAdapter(params = {}, callback) ⇒ AWS.Request
Creates an adapter, which can be fine-tuned for enhanced performance on user provided documents. Takes an AdapterName and FeatureType. Currently the only supported feature type is QUERIES
. You can also provide a Description, Tags, and a ClientRequestToken. You can choose whether or not the adapter should be AutoUpdated with the AutoUpdate argument. By default, AutoUpdate is set to DISABLED.
Service Reference:
Examples:
Calling the createAdapter operation
var params = {
AdapterName: 'STRING_VALUE', /* required */
FeatureTypes: [ /* required */
TABLES | FORMS | QUERIES | SIGNATURES | LAYOUT,
/* more items */
],
AutoUpdate: ENABLED | DISABLED,
ClientRequestToken: 'STRING_VALUE',
Description: 'STRING_VALUE',
Tags: {
'<TagKey>': 'STRING_VALUE',
/* '<TagKey>': ... */
}
};
textract.createAdapter(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
AdapterName
— (String
)The name to be assigned to the adapter being created.
ClientRequestToken
— (String
)Idempotent token is used to recognize the request. If the same token is used with multiple CreateAdapter requests, the same session is returned. This token is employed to avoid unintentionally creating the same session multiple times.
If a token is not provided, the SDK will use a version 4 UUID.Description
— (String
)The description to be assigned to the adapter being created.
FeatureTypes
— (Array<String>
)The type of feature that the adapter is being trained on. Currrenly, supported feature types are:
QUERIES
AutoUpdate
— (String
)Controls whether or not the adapter should automatically update.
Possible values include:"ENABLED"
"DISABLED"
Tags
— (map<String>
)A list of tags to be added to the adapter.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:AdapterId
— (String
)A string containing the unique ID for the adapter that has been created.
-
(AWS.Response)
—
Returns:
createAdapterVersion(params = {}, callback) ⇒ AWS.Request
Creates a new version of an adapter. Operates on a provided AdapterId and a specified dataset provided via the DatasetConfig argument. Requires that you specify an Amazon S3 bucket with the OutputConfig argument. You can provide an optional KMSKeyId, an optional ClientRequestToken, and optional tags.
Service Reference:
Examples:
Calling the createAdapterVersion operation
var params = {
AdapterId: 'STRING_VALUE', /* required */
DatasetConfig: { /* required */
ManifestS3Object: {
Bucket: 'STRING_VALUE',
Name: 'STRING_VALUE',
Version: 'STRING_VALUE'
}
},
OutputConfig: { /* required */
S3Bucket: 'STRING_VALUE', /* required */
S3Prefix: 'STRING_VALUE'
},
ClientRequestToken: 'STRING_VALUE',
KMSKeyId: 'STRING_VALUE',
Tags: {
'<TagKey>': 'STRING_VALUE',
/* '<TagKey>': ... */
}
};
textract.createAdapterVersion(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
AdapterId
— (String
)A string containing a unique ID for the adapter that will receive a new version.
ClientRequestToken
— (String
)Idempotent token is used to recognize the request. If the same token is used with multiple CreateAdapterVersion requests, the same session is returned. This token is employed to avoid unintentionally creating the same session multiple times.
If a token is not provided, the SDK will use a version 4 UUID.DatasetConfig
— (map
)Specifies a dataset used to train a new adapter version. Takes a ManifestS3Object as the value.
ManifestS3Object
— (map
)The S3 bucket name and file name that identifies the document.
The AWS Region for the S3 bucket that contains the document must match the Region that you use for Amazon Textract operations.
For Amazon Textract to process a file in an S3 bucket, the user must have permission to access the S3 bucket and file.
Bucket
— (String
)The name of the S3 bucket. Note that the # character is not valid in the file name.
Name
— (String
)The file name of the input document. Synchronous operations can use image files that are in JPEG or PNG format. Asynchronous operations also support PDF and TIFF format files.
Version
— (String
)If the bucket has versioning enabled, you can specify the object version.
KMSKeyId
— (String
)The identifier for your AWS Key Management Service key (AWS KMS key). Used to encrypt your documents.
OutputConfig
— (map
)Sets whether or not your output will go to a user created bucket. Used to set the name of the bucket, and the prefix on the output file.
OutputConfig
is an optional parameter which lets you adjust where your output will be placed. By default, Amazon Textract will store the results internally and can only be accessed by the Get API operations. WithOutputConfig
enabled, you can set the name of the bucket the output will be sent to the file prefix of the results where you can download your results. Additionally, you can set theKMSKeyID
parameter to a customer master key (CMK) to encrypt your output. Without this parameter set Amazon Textract will encrypt server-side using the AWS managed CMK for Amazon S3.Decryption of Customer Content is necessary for processing of the documents by Amazon Textract. If your account is opted out under an AI services opt out policy then all unencrypted Customer Content is immediately and permanently deleted after the Customer Content has been processed by the service. No copy of of the output is retained by Amazon Textract. For information about how to opt out, see Managing AI services opt-out policy.
For more information on data privacy, see the Data Privacy FAQ.
S3Bucket
— required — (String
)The name of the bucket your output will go to.
S3Prefix
— (String
)The prefix of the object key that the output will be saved to. When not enabled, the prefix will be “textract_output".
Tags
— (map<String>
)A set of tags (key-value pairs) that you want to attach to the adapter version.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:AdapterId
— (String
)A string containing the unique ID for the adapter that has received a new version.
AdapterVersion
— (String
)A string describing the new version of the adapter.
-
(AWS.Response)
—
Returns:
deleteAdapter(params = {}, callback) ⇒ AWS.Request
Deletes an Amazon Textract adapter. Takes an AdapterId and deletes the adapter specified by the ID.
Service Reference:
Examples:
Calling the deleteAdapter operation
var params = {
AdapterId: 'STRING_VALUE' /* required */
};
textract.deleteAdapter(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
AdapterId
— (String
)A string containing a unique ID for the adapter to be deleted.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs.
-
(AWS.Response)
—
Returns:
deleteAdapterVersion(params = {}, callback) ⇒ AWS.Request
Deletes an Amazon Textract adapter version. Requires that you specify both an AdapterId and a AdapterVersion. Deletes the adapter version specified by the AdapterId and the AdapterVersion.
Service Reference:
Examples:
Calling the deleteAdapterVersion operation
var params = {
AdapterId: 'STRING_VALUE', /* required */
AdapterVersion: 'STRING_VALUE' /* required */
};
textract.deleteAdapterVersion(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
AdapterId
— (String
)A string containing a unique ID for the adapter version that will be deleted.
AdapterVersion
— (String
)Specifies the adapter version to be deleted.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs.
-
(AWS.Response)
—
Returns:
detectDocumentText(params = {}, callback) ⇒ AWS.Request
Detects text in the input document. Amazon Textract can detect lines of text and the words that make up a line of text. The input document must be in one of the following image formats: JPEG, PNG, PDF, or TIFF. DetectDocumentText
returns the detected text in an array of Block objects.
Each document page has as an associated Block
of type PAGE. Each PAGE Block
object is the parent of LINE Block
objects that represent the lines of detected text on a page. A LINE Block
object is a parent for each word that makes up the line. Words are represented by Block
objects of type WORD.
DetectDocumentText
is a synchronous operation. To analyze documents asynchronously, use StartDocumentTextDetection.
For more information, see Document Text Detection.
Service Reference:
Examples:
Calling the detectDocumentText operation
var params = {
Document: { /* required */
Bytes: Buffer.from('...') || 'STRING_VALUE' /* Strings will be Base-64 encoded on your behalf */,
S3Object: {
Bucket: 'STRING_VALUE',
Name: 'STRING_VALUE',
Version: 'STRING_VALUE'
}
}
};
textract.detectDocumentText(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
Document
— (map
)The input document as base64-encoded bytes or an Amazon S3 object. If you use the AWS CLI to call Amazon Textract operations, you can't pass image bytes. The document must be an image in JPEG or PNG format.
If you're using an AWS SDK to call Amazon Textract, you might not need to base64-encode image bytes that are passed using the
Bytes
field.Bytes
— (Buffer, Typed Array, Blob, String
)A blob of base64-encoded document 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 JPEG format.
If you're using an AWS SDK to call Amazon Textract, you might not need to base64-encode image bytes passed using the
Bytes
field.S3Object
— (map
)Identifies an S3 object as the document source. The maximum size of a document that's stored in an S3 bucket is 5 MB.
Bucket
— (String
)The name of the S3 bucket. Note that the # character is not valid in the file name.
Name
— (String
)The file name of the input document. Synchronous operations can use image files that are in JPEG or PNG format. Asynchronous operations also support PDF and TIFF format files.
Version
— (String
)If the bucket has versioning enabled, you can specify the object version.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:DocumentMetadata
— (map
)Metadata about the document. It contains the number of pages that are detected in the document.
Pages
— (Integer
)The number of pages that are detected in the document.
Blocks
— (Array<map>
)An array of
Block
objects that contain the text that's detected in the document.BlockType
— (String
)The type of text item that's recognized. In operations for text detection, the following types are returned:
-
PAGE - Contains a list of the LINE
Block
objects that are detected on a document page. -
WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
In text analysis operations, the following types are returned:
-
PAGE - Contains a list of child
Block
objects that are detected on a document page. -
KEY_VALUE_SET - Stores the KEY and VALUE
Block
objects for linked text that's detected on a document page. Use theEntityType
field to determine if a KEY_VALUE_SET object is a KEYBlock
object or a VALUEBlock
object. -
WORD - A word that's detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
-
TABLE - A table that's detected on a document page. A table is grid-based information with two or more rows or columns, with a cell span of one row and one column each.
-
TABLE_TITLE - The title of a table. A title is typically a line of text above or below a table, or embedded as the first row of a table.
-
TABLE_FOOTER - The footer associated with a table. A footer is typically a line or lines of text below a table or embedded as the last row of a table.
-
CELL - A cell within a detected table. The cell is the parent of the block that contains the text in the cell.
-
MERGED_CELL - A cell in a table whose content spans more than one row or column. The
Relationships
array for this cell contain data from individual cells. -
SELECTION_ELEMENT - A selection element such as an option button (radio button) or a check box that's detected on a document page. Use the value of
SelectionStatus
to determine the status of the selection element. -
SIGNATURE - The location and confidence score of a signature detected on a document page. Can be returned as part of a Key-Value pair or a detected cell.
-
QUERY - A question asked during the call of AnalyzeDocument. Contains an alias and an ID that attaches it to its answer.
-
QUERY_RESULT - A response to a question asked during the call of analyze document. Comes with an alias and ID for ease of locating in a response. Also contains location and confidence score.
The following BlockTypes are only returned for Amazon Textract Layout.
-
LAYOUT_TITLE
- The main title of the document. -
LAYOUT_HEADER
- Text located in the top margin of the document. -
LAYOUT_FOOTER
- Text located in the bottom margin of the document. -
LAYOUT_SECTION_HEADER
- The titles of sections within a document. -
LAYOUT_PAGE_NUMBER
- The page number of the documents. -
LAYOUT_LIST
- Any information grouped together in list form. -
LAYOUT_FIGURE
- Indicates the location of an image in a document. -
LAYOUT_TABLE
- Indicates the location of a table in the document. -
LAYOUT_KEY_VALUE
- Indicates the location of form key-values in a document. -
LAYOUT_TEXT
- Text that is present typically as a part of paragraphs in documents.
"KEY_VALUE_SET"
"PAGE"
"LINE"
"WORD"
"TABLE"
"CELL"
"SELECTION_ELEMENT"
"MERGED_CELL"
"TITLE"
"QUERY"
"QUERY_RESULT"
"SIGNATURE"
"TABLE_TITLE"
"TABLE_FOOTER"
"LAYOUT_TEXT"
"LAYOUT_TITLE"
"LAYOUT_HEADER"
"LAYOUT_FOOTER"
"LAYOUT_SECTION_HEADER"
"LAYOUT_PAGE_NUMBER"
"LAYOUT_LIST"
"LAYOUT_FIGURE"
"LAYOUT_TABLE"
"LAYOUT_KEY_VALUE"
-
Confidence
— (Float
)The confidence score that Amazon Textract has in the accuracy of the recognized text and the accuracy of the geometry points around the recognized text.
Text
— (String
)The word or line of text that's recognized by Amazon Textract.
TextType
— (String
)The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
Possible values include:"HANDWRITING"
"PRINTED"
RowIndex
— (Integer
)The row in which a table cell is located. The first row position is 1.
RowIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnIndex
— (Integer
)The column in which a table cell appears. The first column position is 1.
ColumnIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.RowSpan
— (Integer
)The number of rows that a table cell spans.
RowSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnSpan
— (Integer
)The number of columns that a table cell spans.
ColumnSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.Geometry
— (map
)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.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Id
— (String
)The identifier for the recognized text. The identifier is only unique for a single operation.
Relationships
— (Array<map>
)A list of relationship objects that describe how blocks are related to each other. For example, a LINE block object contains a CHILD relationship type with the WORD blocks that make up 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.
Type
— (String
)The type of relationship between the blocks in the IDs array and the current block. The following list describes the relationship types that can be returned.
-
VALUE - A list that contains the ID of the VALUE block that's associated with the KEY of a key-value pair.
-
CHILD - A list of IDs that identify blocks found within the current block object. For example, WORD blocks have a CHILD relationship to the LINE block type.
-
MERGED_CELL - A list of IDs that identify each of the MERGED_CELL block types in a table.
-
ANSWER - A list that contains the ID of the QUERY_RESULT block that’s associated with the corresponding QUERY block.
-
TABLE - A list of IDs that identify associated TABLE block types.
-
TABLE_TITLE - A list that contains the ID for the TABLE_TITLE block type in a table.
-
TABLE_FOOTER - A list of IDs that identify the TABLE_FOOTER block types in a table.
"VALUE"
"CHILD"
"COMPLEX_FEATURES"
"MERGED_CELL"
"TITLE"
"ANSWER"
"TABLE"
"TABLE_TITLE"
"TABLE_FOOTER"
-
Ids
— (Array<String>
)An array of IDs for related blocks. You can get the type of the relationship from the
Type
element.
EntityTypes
— (Array<String>
)The type of entity.
The following entity types can be returned by FORMS analysis:
-
KEY - An identifier for a field on the document.
-
VALUE - The field text.
The following entity types can be returned by TABLES analysis:
-
COLUMN_HEADER - Identifies a cell that is a header of a column.
-
TABLE_TITLE - Identifies a cell that is a title within the table.
-
TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section title is a cell that typically spans an entire row above a section.
-
TABLE_FOOTER - Identifies a cell that is a footer of a table.
-
TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an additional, smaller table that contains summary information for another table.
-
STRUCTURED_TABLE - Identifies a table with column headers where the content of each row corresponds to the headers.
-
SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
EntityTypes
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.-
SelectionStatus
— (String
)The selection status of a selection element, such as an option button or check box.
Possible values include:"SELECTED"
"NOT_SELECTED"
Page
— (Integer
)The page on which a block was detected.
Page
is returned by synchronous and asynchronous operations. Page values greater than 1 are only returned for multipage documents that are in PDF or TIFF format. A scanned image (JPEG/PNG) provided to an asynchronous operation, even if it contains multiple document pages, is considered a single-page document. This means that for scanned images the value ofPage
is always 1.Query
— (map
)Text
— required — (String
)Question that Amazon Textract will apply to the document. An example would be "What is the customer's SSN?"
Alias
— (String
)Alias attached to the query, for ease of location.
Pages
— (Array<String>
)Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter.
-
If a page is not specified, it is set to
["1"]
by default. -
The following characters are allowed in the parameter's string:
0 1 2 3 4 5 6 7 8 9 - *
. No whitespace is allowed. -
When using * to indicate all pages, it must be the only element in the list.
-
You can use page intervals, such as
[“1-3”, “1-1”, “4-*”]
. Where*
indicates last page of document. -
Specified pages must be greater than 0 and less than or equal to the number of pages in the document.
-
DetectDocumentTextModelVersion
— (String
)
-
(AWS.Response)
—
Returns:
getAdapter(params = {}, callback) ⇒ AWS.Request
Gets configuration information for an adapter specified by an AdapterId, returning information on AdapterName, Description, CreationTime, AutoUpdate status, and FeatureTypes.
Service Reference:
Examples:
Calling the getAdapter operation
var params = {
AdapterId: 'STRING_VALUE' /* required */
};
textract.getAdapter(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
AdapterId
— (String
)A string containing a unique ID for the adapter.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:AdapterId
— (String
)A string identifying the adapter that information has been retrieved for.
AdapterName
— (String
)The name of the requested adapter.
CreationTime
— (Date
)The date and time the requested adapter was created at.
Description
— (String
)The description for the requested adapter.
FeatureTypes
— (Array<String>
)List of the targeted feature types for the requested adapter.
AutoUpdate
— (String
)Binary value indicating if the adapter is being automatically updated or not.
Possible values include:"ENABLED"
"DISABLED"
Tags
— (map<String>
)A set of tags (key-value pairs) associated with the adapter that has been retrieved.
-
(AWS.Response)
—
Returns:
getAdapterVersion(params = {}, callback) ⇒ AWS.Request
Gets configuration information for the specified adapter version, including: AdapterId, AdapterVersion, FeatureTypes, Status, StatusMessage, DatasetConfig, KMSKeyId, OutputConfig, Tags and EvaluationMetrics.
Service Reference:
Examples:
Calling the getAdapterVersion operation
var params = {
AdapterId: 'STRING_VALUE', /* required */
AdapterVersion: 'STRING_VALUE' /* required */
};
textract.getAdapterVersion(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
AdapterId
— (String
)A string specifying a unique ID for the adapter version you want to retrieve information for.
AdapterVersion
— (String
)A string specifying the adapter version you want to retrieve information for.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:AdapterId
— (String
)A string containing a unique ID for the adapter version being retrieved.
AdapterVersion
— (String
)A string containing the adapter version that has been retrieved.
CreationTime
— (Date
)The time that the adapter version was created.
FeatureTypes
— (Array<String>
)List of the targeted feature types for the requested adapter version.
Status
— (String
)The status of the adapter version that has been requested.
Possible values include:"ACTIVE"
"AT_RISK"
"DEPRECATED"
"CREATION_ERROR"
"CREATION_IN_PROGRESS"
StatusMessage
— (String
)A message that describes the status of the requested adapter version.
DatasetConfig
— (map
)Specifies a dataset used to train a new adapter version. Takes a ManifestS3Objec as the value.
ManifestS3Object
— (map
)The S3 bucket name and file name that identifies the document.
The AWS Region for the S3 bucket that contains the document must match the Region that you use for Amazon Textract operations.
For Amazon Textract to process a file in an S3 bucket, the user must have permission to access the S3 bucket and file.
Bucket
— (String
)The name of the S3 bucket. Note that the # character is not valid in the file name.
Name
— (String
)The file name of the input document. Synchronous operations can use image files that are in JPEG or PNG format. Asynchronous operations also support PDF and TIFF format files.
Version
— (String
)If the bucket has versioning enabled, you can specify the object version.
KMSKeyId
— (String
)The identifier for your AWS Key Management Service key (AWS KMS key). Used to encrypt your documents.
OutputConfig
— (map
)Sets whether or not your output will go to a user created bucket. Used to set the name of the bucket, and the prefix on the output file.
OutputConfig
is an optional parameter which lets you adjust where your output will be placed. By default, Amazon Textract will store the results internally and can only be accessed by the Get API operations. WithOutputConfig
enabled, you can set the name of the bucket the output will be sent to the file prefix of the results where you can download your results. Additionally, you can set theKMSKeyID
parameter to a customer master key (CMK) to encrypt your output. Without this parameter set Amazon Textract will encrypt server-side using the AWS managed CMK for Amazon S3.Decryption of Customer Content is necessary for processing of the documents by Amazon Textract. If your account is opted out under an AI services opt out policy then all unencrypted Customer Content is immediately and permanently deleted after the Customer Content has been processed by the service. No copy of of the output is retained by Amazon Textract. For information about how to opt out, see Managing AI services opt-out policy.
For more information on data privacy, see the Data Privacy FAQ.
S3Bucket
— required — (String
)The name of the bucket your output will go to.
S3Prefix
— (String
)The prefix of the object key that the output will be saved to. When not enabled, the prefix will be “textract_output".
EvaluationMetrics
— (Array<map>
)The evaluation metrics (F1 score, Precision, and Recall) for the requested version, grouped by baseline metrics and adapter version.
Baseline
— (map
)The F1 score, precision, and recall metrics for the baseline model.
F1Score
— (Float
)The F1 score for an adapter version.
Precision
— (Float
)The Precision score for an adapter version.
Recall
— (Float
)The Recall score for an adapter version.
AdapterVersion
— (map
)The F1 score, precision, and recall metrics for the baseline model.
F1Score
— (Float
)The F1 score for an adapter version.
Precision
— (Float
)The Precision score for an adapter version.
Recall
— (Float
)The Recall score for an adapter version.
FeatureType
— (String
)Indicates the feature type being analyzed by a given adapter version.
Possible values include:"TABLES"
"FORMS"
"QUERIES"
"SIGNATURES"
"LAYOUT"
Tags
— (map<String>
)A set of tags (key-value pairs) that are associated with the adapter version.
-
(AWS.Response)
—
Returns:
getDocumentAnalysis(params = {}, callback) ⇒ AWS.Request
Gets the results for an Amazon Textract asynchronous operation that analyzes text in a document.
You start asynchronous text analysis by calling StartDocumentAnalysis, which returns a job identifier (JobId
). When the text analysis operation finishes, Amazon Textract publishes a completion status to the Amazon Simple Notification Service (Amazon SNS) topic that's registered in the initial call to StartDocumentAnalysis
. To get the results of the text-detection operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED
. If so, call GetDocumentAnalysis
, and pass the job identifier (JobId
) from the initial call to StartDocumentAnalysis
.
GetDocumentAnalysis
returns an array of Block objects. The following types of information are returned:
-
Form data (key-value pairs). The related information is returned in two Block objects, each of type
KEY_VALUE_SET
: a KEYBlock
object and a VALUEBlock
object. For example, Name: Ana Silva Carolina contains a key and value. Name: is the key. Ana Silva Carolina is the value. -
Table and table cell data. A TABLE
Block
object contains information about a detected table. A CELLBlock
object is returned for each cell in a table. -
Lines and words of text. A LINE
Block
object contains one or more WORDBlock
objects. All lines and words that are detected in the document are returned (including text that doesn't have a relationship with the value of theStartDocumentAnalysis
FeatureTypes
input parameter). -
Query. A QUERY Block object contains the query text, alias and link to the associated Query results block object.
-
Query Results. A QUERY_RESULT Block object contains the answer to the query and an ID that connects it to the query asked. This Block also contains a confidence score.
INVALID_REQUEST_PARAMETERS
output. This indicates that either the per page query limit has been exceeded or that the operation is trying to query a page in the document which doesn’t exist. Selection elements such as check boxes and option buttons (radio buttons) can be detected in form data and in tables. A SELECTION_ELEMENT Block
object contains information about a selection element, including the selection status.
Use the MaxResults
parameter to limit the number of blocks that are returned. If there are more results than specified in MaxResults
, the value of NextToken
in the operation response contains a pagination token for getting the next set of results. To get the next page of results, call GetDocumentAnalysis
, and populate the NextToken
request parameter with the token value that's returned from the previous call to GetDocumentAnalysis
.
For more information, see Document Text Analysis.
Service Reference:
Examples:
Calling the getDocumentAnalysis operation
var params = {
JobId: 'STRING_VALUE', /* required */
MaxResults: 'NUMBER_VALUE',
NextToken: 'STRING_VALUE'
};
textract.getDocumentAnalysis(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
JobId
— (String
)A unique identifier for the text-detection job. The
JobId
is returned fromStartDocumentAnalysis
. AJobId
value is only valid for 7 days.MaxResults
— (Integer
)The maximum number of results to return per paginated call. The largest value that you can specify is 1,000. If you specify a value greater than 1,000, a maximum of 1,000 results is returned. The default value is 1,000.
NextToken
— (String
)If the previous response was incomplete (because there are more blocks to retrieve), Amazon Textract returns a pagination token in the response. You can use this pagination token to retrieve the next set of blocks.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:DocumentMetadata
— (map
)Information about a document that Amazon Textract processed.
DocumentMetadata
is returned in every page of paginated responses from an Amazon Textract video operation.Pages
— (Integer
)The number of pages that are detected in the document.
JobStatus
— (String
)The current status of the text detection job.
Possible values include:"IN_PROGRESS"
"SUCCEEDED"
"FAILED"
"PARTIAL_SUCCESS"
NextToken
— (String
)If the response is truncated, Amazon Textract returns this token. You can use this token in the subsequent request to retrieve the next set of text detection results.
Blocks
— (Array<map>
)The results of the text-analysis operation.
BlockType
— (String
)The type of text item that's recognized. In operations for text detection, the following types are returned:
-
PAGE - Contains a list of the LINE
Block
objects that are detected on a document page. -
WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
In text analysis operations, the following types are returned:
-
PAGE - Contains a list of child
Block
objects that are detected on a document page. -
KEY_VALUE_SET - Stores the KEY and VALUE
Block
objects for linked text that's detected on a document page. Use theEntityType
field to determine if a KEY_VALUE_SET object is a KEYBlock
object or a VALUEBlock
object. -
WORD - A word that's detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
-
TABLE - A table that's detected on a document page. A table is grid-based information with two or more rows or columns, with a cell span of one row and one column each.
-
TABLE_TITLE - The title of a table. A title is typically a line of text above or below a table, or embedded as the first row of a table.
-
TABLE_FOOTER - The footer associated with a table. A footer is typically a line or lines of text below a table or embedded as the last row of a table.
-
CELL - A cell within a detected table. The cell is the parent of the block that contains the text in the cell.
-
MERGED_CELL - A cell in a table whose content spans more than one row or column. The
Relationships
array for this cell contain data from individual cells. -
SELECTION_ELEMENT - A selection element such as an option button (radio button) or a check box that's detected on a document page. Use the value of
SelectionStatus
to determine the status of the selection element. -
SIGNATURE - The location and confidence score of a signature detected on a document page. Can be returned as part of a Key-Value pair or a detected cell.
-
QUERY - A question asked during the call of AnalyzeDocument. Contains an alias and an ID that attaches it to its answer.
-
QUERY_RESULT - A response to a question asked during the call of analyze document. Comes with an alias and ID for ease of locating in a response. Also contains location and confidence score.
The following BlockTypes are only returned for Amazon Textract Layout.
-
LAYOUT_TITLE
- The main title of the document. -
LAYOUT_HEADER
- Text located in the top margin of the document. -
LAYOUT_FOOTER
- Text located in the bottom margin of the document. -
LAYOUT_SECTION_HEADER
- The titles of sections within a document. -
LAYOUT_PAGE_NUMBER
- The page number of the documents. -
LAYOUT_LIST
- Any information grouped together in list form. -
LAYOUT_FIGURE
- Indicates the location of an image in a document. -
LAYOUT_TABLE
- Indicates the location of a table in the document. -
LAYOUT_KEY_VALUE
- Indicates the location of form key-values in a document. -
LAYOUT_TEXT
- Text that is present typically as a part of paragraphs in documents.
"KEY_VALUE_SET"
"PAGE"
"LINE"
"WORD"
"TABLE"
"CELL"
"SELECTION_ELEMENT"
"MERGED_CELL"
"TITLE"
"QUERY"
"QUERY_RESULT"
"SIGNATURE"
"TABLE_TITLE"
"TABLE_FOOTER"
"LAYOUT_TEXT"
"LAYOUT_TITLE"
"LAYOUT_HEADER"
"LAYOUT_FOOTER"
"LAYOUT_SECTION_HEADER"
"LAYOUT_PAGE_NUMBER"
"LAYOUT_LIST"
"LAYOUT_FIGURE"
"LAYOUT_TABLE"
"LAYOUT_KEY_VALUE"
-
Confidence
— (Float
)The confidence score that Amazon Textract has in the accuracy of the recognized text and the accuracy of the geometry points around the recognized text.
Text
— (String
)The word or line of text that's recognized by Amazon Textract.
TextType
— (String
)The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
Possible values include:"HANDWRITING"
"PRINTED"
RowIndex
— (Integer
)The row in which a table cell is located. The first row position is 1.
RowIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnIndex
— (Integer
)The column in which a table cell appears. The first column position is 1.
ColumnIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.RowSpan
— (Integer
)The number of rows that a table cell spans.
RowSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnSpan
— (Integer
)The number of columns that a table cell spans.
ColumnSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.Geometry
— (map
)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.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Id
— (String
)The identifier for the recognized text. The identifier is only unique for a single operation.
Relationships
— (Array<map>
)A list of relationship objects that describe how blocks are related to each other. For example, a LINE block object contains a CHILD relationship type with the WORD blocks that make up 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.
Type
— (String
)The type of relationship between the blocks in the IDs array and the current block. The following list describes the relationship types that can be returned.
-
VALUE - A list that contains the ID of the VALUE block that's associated with the KEY of a key-value pair.
-
CHILD - A list of IDs that identify blocks found within the current block object. For example, WORD blocks have a CHILD relationship to the LINE block type.
-
MERGED_CELL - A list of IDs that identify each of the MERGED_CELL block types in a table.
-
ANSWER - A list that contains the ID of the QUERY_RESULT block that’s associated with the corresponding QUERY block.
-
TABLE - A list of IDs that identify associated TABLE block types.
-
TABLE_TITLE - A list that contains the ID for the TABLE_TITLE block type in a table.
-
TABLE_FOOTER - A list of IDs that identify the TABLE_FOOTER block types in a table.
"VALUE"
"CHILD"
"COMPLEX_FEATURES"
"MERGED_CELL"
"TITLE"
"ANSWER"
"TABLE"
"TABLE_TITLE"
"TABLE_FOOTER"
-
Ids
— (Array<String>
)An array of IDs for related blocks. You can get the type of the relationship from the
Type
element.
EntityTypes
— (Array<String>
)The type of entity.
The following entity types can be returned by FORMS analysis:
-
KEY - An identifier for a field on the document.
-
VALUE - The field text.
The following entity types can be returned by TABLES analysis:
-
COLUMN_HEADER - Identifies a cell that is a header of a column.
-
TABLE_TITLE - Identifies a cell that is a title within the table.
-
TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section title is a cell that typically spans an entire row above a section.
-
TABLE_FOOTER - Identifies a cell that is a footer of a table.
-
TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an additional, smaller table that contains summary information for another table.
-
STRUCTURED_TABLE - Identifies a table with column headers where the content of each row corresponds to the headers.
-
SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
EntityTypes
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.-
SelectionStatus
— (String
)The selection status of a selection element, such as an option button or check box.
Possible values include:"SELECTED"
"NOT_SELECTED"
Page
— (Integer
)The page on which a block was detected.
Page
is returned by synchronous and asynchronous operations. Page values greater than 1 are only returned for multipage documents that are in PDF or TIFF format. A scanned image (JPEG/PNG) provided to an asynchronous operation, even if it contains multiple document pages, is considered a single-page document. This means that for scanned images the value ofPage
is always 1.Query
— (map
)Text
— required — (String
)Question that Amazon Textract will apply to the document. An example would be "What is the customer's SSN?"
Alias
— (String
)Alias attached to the query, for ease of location.
Pages
— (Array<String>
)Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter.
-
If a page is not specified, it is set to
["1"]
by default. -
The following characters are allowed in the parameter's string:
0 1 2 3 4 5 6 7 8 9 - *
. No whitespace is allowed. -
When using * to indicate all pages, it must be the only element in the list.
-
You can use page intervals, such as
[“1-3”, “1-1”, “4-*”]
. Where*
indicates last page of document. -
Specified pages must be greater than 0 and less than or equal to the number of pages in the document.
-
Warnings
— (Array<map>
)A list of warnings that occurred during the document-analysis operation.
ErrorCode
— (String
)The error code for the warning.
Pages
— (Array<Integer>
)A list of the pages that the warning applies to.
StatusMessage
— (String
)Returns if the detection job could not be completed. Contains explanation for what error occured.
AnalyzeDocumentModelVersion
— (String
)
-
(AWS.Response)
—
Returns:
getDocumentTextDetection(params = {}, callback) ⇒ AWS.Request
Gets the results for an Amazon Textract asynchronous operation that detects text in a document. Amazon Textract can detect lines of text and the words that make up a line of text.
You start asynchronous text detection by calling StartDocumentTextDetection, which returns a job identifier (JobId
). When the text detection operation finishes, Amazon Textract publishes a completion status to the Amazon Simple Notification Service (Amazon SNS) topic that's registered in the initial call to StartDocumentTextDetection
. To get the results of the text-detection operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED
. If so, call GetDocumentTextDetection
, and pass the job identifier (JobId
) from the initial call to StartDocumentTextDetection
.
GetDocumentTextDetection
returns an array of Block objects.
Each document page has as an associated Block
of type PAGE. Each PAGE Block
object is the parent of LINE Block
objects that represent the lines of detected text on a page. A LINE Block
object is a parent for each word that makes up the line. Words are represented by Block
objects of type WORD.
Use the MaxResults parameter to limit the number of blocks that are returned. If there are more results than specified in MaxResults
, the value of NextToken
in the operation response contains a pagination token for getting the next set of results. To get the next page of results, call GetDocumentTextDetection
, and populate the NextToken
request parameter with the token value that's returned from the previous call to GetDocumentTextDetection
.
For more information, see Document Text Detection.
Service Reference:
Examples:
Calling the getDocumentTextDetection operation
var params = {
JobId: 'STRING_VALUE', /* required */
MaxResults: 'NUMBER_VALUE',
NextToken: 'STRING_VALUE'
};
textract.getDocumentTextDetection(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
JobId
— (String
)A unique identifier for the text detection job. The
JobId
is returned fromStartDocumentTextDetection
. AJobId
value is only valid for 7 days.MaxResults
— (Integer
)The maximum number of results to return per paginated call. The largest value you can specify is 1,000. If you specify a value greater than 1,000, a maximum of 1,000 results is returned. The default value is 1,000.
NextToken
— (String
)If the previous response was incomplete (because there are more blocks to retrieve), Amazon Textract returns a pagination token in the response. You can use this pagination token to retrieve the next set of blocks.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:DocumentMetadata
— (map
)Information about a document that Amazon Textract processed.
DocumentMetadata
is returned in every page of paginated responses from an Amazon Textract video operation.Pages
— (Integer
)The number of pages that are detected in the document.
JobStatus
— (String
)The current status of the text detection job.
Possible values include:"IN_PROGRESS"
"SUCCEEDED"
"FAILED"
"PARTIAL_SUCCESS"
NextToken
— (String
)If the response is truncated, Amazon Textract returns this token. You can use this token in the subsequent request to retrieve the next set of text-detection results.
Blocks
— (Array<map>
)The results of the text-detection operation.
BlockType
— (String
)The type of text item that's recognized. In operations for text detection, the following types are returned:
-
PAGE - Contains a list of the LINE
Block
objects that are detected on a document page. -
WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
In text analysis operations, the following types are returned:
-
PAGE - Contains a list of child
Block
objects that are detected on a document page. -
KEY_VALUE_SET - Stores the KEY and VALUE
Block
objects for linked text that's detected on a document page. Use theEntityType
field to determine if a KEY_VALUE_SET object is a KEYBlock
object or a VALUEBlock
object. -
WORD - A word that's detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
-
TABLE - A table that's detected on a document page. A table is grid-based information with two or more rows or columns, with a cell span of one row and one column each.
-
TABLE_TITLE - The title of a table. A title is typically a line of text above or below a table, or embedded as the first row of a table.
-
TABLE_FOOTER - The footer associated with a table. A footer is typically a line or lines of text below a table or embedded as the last row of a table.
-
CELL - A cell within a detected table. The cell is the parent of the block that contains the text in the cell.
-
MERGED_CELL - A cell in a table whose content spans more than one row or column. The
Relationships
array for this cell contain data from individual cells. -
SELECTION_ELEMENT - A selection element such as an option button (radio button) or a check box that's detected on a document page. Use the value of
SelectionStatus
to determine the status of the selection element. -
SIGNATURE - The location and confidence score of a signature detected on a document page. Can be returned as part of a Key-Value pair or a detected cell.
-
QUERY - A question asked during the call of AnalyzeDocument. Contains an alias and an ID that attaches it to its answer.
-
QUERY_RESULT - A response to a question asked during the call of analyze document. Comes with an alias and ID for ease of locating in a response. Also contains location and confidence score.
The following BlockTypes are only returned for Amazon Textract Layout.
-
LAYOUT_TITLE
- The main title of the document. -
LAYOUT_HEADER
- Text located in the top margin of the document. -
LAYOUT_FOOTER
- Text located in the bottom margin of the document. -
LAYOUT_SECTION_HEADER
- The titles of sections within a document. -
LAYOUT_PAGE_NUMBER
- The page number of the documents. -
LAYOUT_LIST
- Any information grouped together in list form. -
LAYOUT_FIGURE
- Indicates the location of an image in a document. -
LAYOUT_TABLE
- Indicates the location of a table in the document. -
LAYOUT_KEY_VALUE
- Indicates the location of form key-values in a document. -
LAYOUT_TEXT
- Text that is present typically as a part of paragraphs in documents.
"KEY_VALUE_SET"
"PAGE"
"LINE"
"WORD"
"TABLE"
"CELL"
"SELECTION_ELEMENT"
"MERGED_CELL"
"TITLE"
"QUERY"
"QUERY_RESULT"
"SIGNATURE"
"TABLE_TITLE"
"TABLE_FOOTER"
"LAYOUT_TEXT"
"LAYOUT_TITLE"
"LAYOUT_HEADER"
"LAYOUT_FOOTER"
"LAYOUT_SECTION_HEADER"
"LAYOUT_PAGE_NUMBER"
"LAYOUT_LIST"
"LAYOUT_FIGURE"
"LAYOUT_TABLE"
"LAYOUT_KEY_VALUE"
-
Confidence
— (Float
)The confidence score that Amazon Textract has in the accuracy of the recognized text and the accuracy of the geometry points around the recognized text.
Text
— (String
)The word or line of text that's recognized by Amazon Textract.
TextType
— (String
)The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
Possible values include:"HANDWRITING"
"PRINTED"
RowIndex
— (Integer
)The row in which a table cell is located. The first row position is 1.
RowIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnIndex
— (Integer
)The column in which a table cell appears. The first column position is 1.
ColumnIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.RowSpan
— (Integer
)The number of rows that a table cell spans.
RowSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnSpan
— (Integer
)The number of columns that a table cell spans.
ColumnSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.Geometry
— (map
)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.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Id
— (String
)The identifier for the recognized text. The identifier is only unique for a single operation.
Relationships
— (Array<map>
)A list of relationship objects that describe how blocks are related to each other. For example, a LINE block object contains a CHILD relationship type with the WORD blocks that make up 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.
Type
— (String
)The type of relationship between the blocks in the IDs array and the current block. The following list describes the relationship types that can be returned.
-
VALUE - A list that contains the ID of the VALUE block that's associated with the KEY of a key-value pair.
-
CHILD - A list of IDs that identify blocks found within the current block object. For example, WORD blocks have a CHILD relationship to the LINE block type.
-
MERGED_CELL - A list of IDs that identify each of the MERGED_CELL block types in a table.
-
ANSWER - A list that contains the ID of the QUERY_RESULT block that’s associated with the corresponding QUERY block.
-
TABLE - A list of IDs that identify associated TABLE block types.
-
TABLE_TITLE - A list that contains the ID for the TABLE_TITLE block type in a table.
-
TABLE_FOOTER - A list of IDs that identify the TABLE_FOOTER block types in a table.
"VALUE"
"CHILD"
"COMPLEX_FEATURES"
"MERGED_CELL"
"TITLE"
"ANSWER"
"TABLE"
"TABLE_TITLE"
"TABLE_FOOTER"
-
Ids
— (Array<String>
)An array of IDs for related blocks. You can get the type of the relationship from the
Type
element.
EntityTypes
— (Array<String>
)The type of entity.
The following entity types can be returned by FORMS analysis:
-
KEY - An identifier for a field on the document.
-
VALUE - The field text.
The following entity types can be returned by TABLES analysis:
-
COLUMN_HEADER - Identifies a cell that is a header of a column.
-
TABLE_TITLE - Identifies a cell that is a title within the table.
-
TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section title is a cell that typically spans an entire row above a section.
-
TABLE_FOOTER - Identifies a cell that is a footer of a table.
-
TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an additional, smaller table that contains summary information for another table.
-
STRUCTURED_TABLE - Identifies a table with column headers where the content of each row corresponds to the headers.
-
SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
EntityTypes
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.-
SelectionStatus
— (String
)The selection status of a selection element, such as an option button or check box.
Possible values include:"SELECTED"
"NOT_SELECTED"
Page
— (Integer
)The page on which a block was detected.
Page
is returned by synchronous and asynchronous operations. Page values greater than 1 are only returned for multipage documents that are in PDF or TIFF format. A scanned image (JPEG/PNG) provided to an asynchronous operation, even if it contains multiple document pages, is considered a single-page document. This means that for scanned images the value ofPage
is always 1.Query
— (map
)Text
— required — (String
)Question that Amazon Textract will apply to the document. An example would be "What is the customer's SSN?"
Alias
— (String
)Alias attached to the query, for ease of location.
Pages
— (Array<String>
)Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter.
-
If a page is not specified, it is set to
["1"]
by default. -
The following characters are allowed in the parameter's string:
0 1 2 3 4 5 6 7 8 9 - *
. No whitespace is allowed. -
When using * to indicate all pages, it must be the only element in the list.
-
You can use page intervals, such as
[“1-3”, “1-1”, “4-*”]
. Where*
indicates last page of document. -
Specified pages must be greater than 0 and less than or equal to the number of pages in the document.
-
Warnings
— (Array<map>
)A list of warnings that occurred during the text-detection operation for the document.
ErrorCode
— (String
)The error code for the warning.
Pages
— (Array<Integer>
)A list of the pages that the warning applies to.
StatusMessage
— (String
)Returns if the detection job could not be completed. Contains explanation for what error occured.
DetectDocumentTextModelVersion
— (String
)
-
(AWS.Response)
—
Returns:
getExpenseAnalysis(params = {}, callback) ⇒ AWS.Request
Gets the results for an Amazon Textract asynchronous operation that analyzes invoices and receipts. Amazon Textract finds contact information, items purchased, and vendor name, from input invoices and receipts.
You start asynchronous invoice/receipt analysis by calling StartExpenseAnalysis, which returns a job identifier (JobId
). Upon completion of the invoice/receipt analysis, Amazon Textract publishes the completion status to the Amazon Simple Notification Service (Amazon SNS) topic. This topic must be registered in the initial call to StartExpenseAnalysis
. To get the results of the invoice/receipt analysis operation, first ensure that the status value published to the Amazon SNS topic is SUCCEEDED
. If so, call GetExpenseAnalysis
, and pass the job identifier (JobId
) from the initial call to StartExpenseAnalysis
.
Use the MaxResults parameter to limit the number of blocks that are returned. If there are more results than specified in MaxResults
, the value of NextToken
in the operation response contains a pagination token for getting the next set of results. To get the next page of results, call GetExpenseAnalysis
, and populate the NextToken
request parameter with the token value that's returned from the previous call to GetExpenseAnalysis
.
For more information, see Analyzing Invoices and Receipts.
Service Reference:
Examples:
Calling the getExpenseAnalysis operation
var params = {
JobId: 'STRING_VALUE', /* required */
MaxResults: 'NUMBER_VALUE',
NextToken: 'STRING_VALUE'
};
textract.getExpenseAnalysis(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
JobId
— (String
)A unique identifier for the text detection job. The
JobId
is returned fromStartExpenseAnalysis
. AJobId
value is only valid for 7 days.MaxResults
— (Integer
)The maximum number of results to return per paginated call. The largest value you can specify is 20. If you specify a value greater than 20, a maximum of 20 results is returned. The default value is 20.
NextToken
— (String
)If the previous response was incomplete (because there are more blocks to retrieve), Amazon Textract returns a pagination token in the response. You can use this pagination token to retrieve the next set of blocks.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:DocumentMetadata
— (map
)Information about a document that Amazon Textract processed.
DocumentMetadata
is returned in every page of paginated responses from an Amazon Textract operation.Pages
— (Integer
)The number of pages that are detected in the document.
JobStatus
— (String
)The current status of the text detection job.
Possible values include:"IN_PROGRESS"
"SUCCEEDED"
"FAILED"
"PARTIAL_SUCCESS"
NextToken
— (String
)If the response is truncated, Amazon Textract returns this token. You can use this token in the subsequent request to retrieve the next set of text-detection results.
ExpenseDocuments
— (Array<map>
)The expenses detected by Amazon Textract.
ExpenseIndex
— (Integer
)Denotes which invoice or receipt in the document the information is coming from. First document will be 1, the second 2, and so on.
SummaryFields
— (Array<map>
)Any information found outside of a table by Amazon Textract.
Type
— (map
)The implied label of a detected element. Present alongside LabelDetection for explicit elements.
Text
— (String
)The word or line of text detected by Amazon Textract.
Confidence
— (Float
)The confidence of accuracy, as a percentage.
LabelDetection
— (map
)The explicitly stated label of a detected element.
Text
— (String
)The word or line of text recognized by Amazon Textract
Geometry
— (map
)Information about where the following items are located on a document page: detected page, text, key-value pairs, tables, table cells, and selection elements.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Confidence
— (Float
)The confidence in detection, as a percentage
ValueDetection
— (map
)The value of a detected element. Present in explicit and implicit elements.
Text
— (String
)The word or line of text recognized by Amazon Textract
Geometry
— (map
)Information about where the following items are located on a document page: detected page, text, key-value pairs, tables, table cells, and selection elements.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Confidence
— (Float
)The confidence in detection, as a percentage
PageNumber
— (Integer
)The page number the value was detected on.
Currency
— (map
)Shows the kind of currency, both the code and confidence associated with any monatary value detected.
Code
— (String
)Currency code for detected currency. the current supported codes are:
-
USD
-
EUR
-
GBP
-
CAD
-
INR
-
JPY
-
CHF
-
AUD
-
CNY
-
BZR
-
SEK
-
HKD
-
Confidence
— (Float
)Percentage confideence in the detected currency.
GroupProperties
— (Array<map>
)Shows which group a response object belongs to, such as whether an address line belongs to the vendor's address or the recipent's address.
Types
— (Array<String>
)Informs you on whether the expense group is a name or an address.
Id
— (String
)Provides a group Id number, which will be the same for each in the group.
LineItemGroups
— (Array<map>
)Information detected on each table of a document, seperated into
LineItems
.LineItemGroupIndex
— (Integer
)The number used to identify a specific table in a document. The first table encountered will have a LineItemGroupIndex of 1, the second 2, etc.
LineItems
— (Array<map>
)The breakdown of information on a particular line of a table.
LineItemExpenseFields
— (Array<map>
)ExpenseFields used to show information from detected lines on a table.
Type
— (map
)The implied label of a detected element. Present alongside LabelDetection for explicit elements.
Text
— (String
)The word or line of text detected by Amazon Textract.
Confidence
— (Float
)The confidence of accuracy, as a percentage.
LabelDetection
— (map
)The explicitly stated label of a detected element.
Text
— (String
)The word or line of text recognized by Amazon Textract
Geometry
— (map
)Information about where the following items are located on a document page: detected page, text, key-value pairs, tables, table cells, and selection elements.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Confidence
— (Float
)The confidence in detection, as a percentage
ValueDetection
— (map
)The value of a detected element. Present in explicit and implicit elements.
Text
— (String
)The word or line of text recognized by Amazon Textract
Geometry
— (map
)Information about where the following items are located on a document page: detected page, text, key-value pairs, tables, table cells, and selection elements.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Confidence
— (Float
)The confidence in detection, as a percentage
PageNumber
— (Integer
)The page number the value was detected on.
Currency
— (map
)Shows the kind of currency, both the code and confidence associated with any monatary value detected.
Code
— (String
)Currency code for detected currency. the current supported codes are:
-
USD
-
EUR
-
GBP
-
CAD
-
INR
-
JPY
-
CHF
-
AUD
-
CNY
-
BZR
-
SEK
-
HKD
-
Confidence
— (Float
)Percentage confideence in the detected currency.
GroupProperties
— (Array<map>
)Shows which group a response object belongs to, such as whether an address line belongs to the vendor's address or the recipent's address.
Types
— (Array<String>
)Informs you on whether the expense group is a name or an address.
Id
— (String
)Provides a group Id number, which will be the same for each in the group.
Blocks
— (Array<map>
)This is a block object, the same as reported when DetectDocumentText is run on a document. It provides word level recognition of text.
BlockType
— (String
)The type of text item that's recognized. In operations for text detection, the following types are returned:
-
PAGE - Contains a list of the LINE
Block
objects that are detected on a document page. -
WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
In text analysis operations, the following types are returned:
-
PAGE - Contains a list of child
Block
objects that are detected on a document page. -
KEY_VALUE_SET - Stores the KEY and VALUE
Block
objects for linked text that's detected on a document page. Use theEntityType
field to determine if a KEY_VALUE_SET object is a KEYBlock
object or a VALUEBlock
object. -
WORD - A word that's detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
-
TABLE - A table that's detected on a document page. A table is grid-based information with two or more rows or columns, with a cell span of one row and one column each.
-
TABLE_TITLE - The title of a table. A title is typically a line of text above or below a table, or embedded as the first row of a table.
-
TABLE_FOOTER - The footer associated with a table. A footer is typically a line or lines of text below a table or embedded as the last row of a table.
-
CELL - A cell within a detected table. The cell is the parent of the block that contains the text in the cell.
-
MERGED_CELL - A cell in a table whose content spans more than one row or column. The
Relationships
array for this cell contain data from individual cells. -
SELECTION_ELEMENT - A selection element such as an option button (radio button) or a check box that's detected on a document page. Use the value of
SelectionStatus
to determine the status of the selection element. -
SIGNATURE - The location and confidence score of a signature detected on a document page. Can be returned as part of a Key-Value pair or a detected cell.
-
QUERY - A question asked during the call of AnalyzeDocument. Contains an alias and an ID that attaches it to its answer.
-
QUERY_RESULT - A response to a question asked during the call of analyze document. Comes with an alias and ID for ease of locating in a response. Also contains location and confidence score.
The following BlockTypes are only returned for Amazon Textract Layout.
-
LAYOUT_TITLE
- The main title of the document. -
LAYOUT_HEADER
- Text located in the top margin of the document. -
LAYOUT_FOOTER
- Text located in the bottom margin of the document. -
LAYOUT_SECTION_HEADER
- The titles of sections within a document. -
LAYOUT_PAGE_NUMBER
- The page number of the documents. -
LAYOUT_LIST
- Any information grouped together in list form. -
LAYOUT_FIGURE
- Indicates the location of an image in a document. -
LAYOUT_TABLE
- Indicates the location of a table in the document. -
LAYOUT_KEY_VALUE
- Indicates the location of form key-values in a document. -
LAYOUT_TEXT
- Text that is present typically as a part of paragraphs in documents.
"KEY_VALUE_SET"
"PAGE"
"LINE"
"WORD"
"TABLE"
"CELL"
"SELECTION_ELEMENT"
"MERGED_CELL"
"TITLE"
"QUERY"
"QUERY_RESULT"
"SIGNATURE"
"TABLE_TITLE"
"TABLE_FOOTER"
"LAYOUT_TEXT"
"LAYOUT_TITLE"
"LAYOUT_HEADER"
"LAYOUT_FOOTER"
"LAYOUT_SECTION_HEADER"
"LAYOUT_PAGE_NUMBER"
"LAYOUT_LIST"
"LAYOUT_FIGURE"
"LAYOUT_TABLE"
"LAYOUT_KEY_VALUE"
-
Confidence
— (Float
)The confidence score that Amazon Textract has in the accuracy of the recognized text and the accuracy of the geometry points around the recognized text.
Text
— (String
)The word or line of text that's recognized by Amazon Textract.
TextType
— (String
)The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
Possible values include:"HANDWRITING"
"PRINTED"
RowIndex
— (Integer
)The row in which a table cell is located. The first row position is 1.
RowIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnIndex
— (Integer
)The column in which a table cell appears. The first column position is 1.
ColumnIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.RowSpan
— (Integer
)The number of rows that a table cell spans.
RowSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnSpan
— (Integer
)The number of columns that a table cell spans.
ColumnSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.Geometry
— (map
)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.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Id
— (String
)The identifier for the recognized text. The identifier is only unique for a single operation.
Relationships
— (Array<map>
)A list of relationship objects that describe how blocks are related to each other. For example, a LINE block object contains a CHILD relationship type with the WORD blocks that make up 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.
Type
— (String
)The type of relationship between the blocks in the IDs array and the current block. The following list describes the relationship types that can be returned.
-
VALUE - A list that contains the ID of the VALUE block that's associated with the KEY of a key-value pair.
-
CHILD - A list of IDs that identify blocks found within the current block object. For example, WORD blocks have a CHILD relationship to the LINE block type.
-
MERGED_CELL - A list of IDs that identify each of the MERGED_CELL block types in a table.
-
ANSWER - A list that contains the ID of the QUERY_RESULT block that’s associated with the corresponding QUERY block.
-
TABLE - A list of IDs that identify associated TABLE block types.
-
TABLE_TITLE - A list that contains the ID for the TABLE_TITLE block type in a table.
-
TABLE_FOOTER - A list of IDs that identify the TABLE_FOOTER block types in a table.
"VALUE"
"CHILD"
"COMPLEX_FEATURES"
"MERGED_CELL"
"TITLE"
"ANSWER"
"TABLE"
"TABLE_TITLE"
"TABLE_FOOTER"
-
Ids
— (Array<String>
)An array of IDs for related blocks. You can get the type of the relationship from the
Type
element.
EntityTypes
— (Array<String>
)The type of entity.
The following entity types can be returned by FORMS analysis:
-
KEY - An identifier for a field on the document.
-
VALUE - The field text.
The following entity types can be returned by TABLES analysis:
-
COLUMN_HEADER - Identifies a cell that is a header of a column.
-
TABLE_TITLE - Identifies a cell that is a title within the table.
-
TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section title is a cell that typically spans an entire row above a section.
-
TABLE_FOOTER - Identifies a cell that is a footer of a table.
-
TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an additional, smaller table that contains summary information for another table.
-
STRUCTURED_TABLE - Identifies a table with column headers where the content of each row corresponds to the headers.
-
SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
EntityTypes
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.-
SelectionStatus
— (String
)The selection status of a selection element, such as an option button or check box.
Possible values include:"SELECTED"
"NOT_SELECTED"
Page
— (Integer
)The page on which a block was detected.
Page
is returned by synchronous and asynchronous operations. Page values greater than 1 are only returned for multipage documents that are in PDF or TIFF format. A scanned image (JPEG/PNG) provided to an asynchronous operation, even if it contains multiple document pages, is considered a single-page document. This means that for scanned images the value ofPage
is always 1.Query
— (map
)Text
— required — (String
)Question that Amazon Textract will apply to the document. An example would be "What is the customer's SSN?"
Alias
— (String
)Alias attached to the query, for ease of location.
Pages
— (Array<String>
)Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter.
-
If a page is not specified, it is set to
["1"]
by default. -
The following characters are allowed in the parameter's string:
0 1 2 3 4 5 6 7 8 9 - *
. No whitespace is allowed. -
When using * to indicate all pages, it must be the only element in the list.
-
You can use page intervals, such as
[“1-3”, “1-1”, “4-*”]
. Where*
indicates last page of document. -
Specified pages must be greater than 0 and less than or equal to the number of pages in the document.
-
Warnings
— (Array<map>
)A list of warnings that occurred during the text-detection operation for the document.
ErrorCode
— (String
)The error code for the warning.
Pages
— (Array<Integer>
)A list of the pages that the warning applies to.
StatusMessage
— (String
)Returns if the detection job could not be completed. Contains explanation for what error occured.
AnalyzeExpenseModelVersion
— (String
)The current model version of AnalyzeExpense.
-
(AWS.Response)
—
Returns:
getLendingAnalysis(params = {}, callback) ⇒ AWS.Request
Gets the results for an Amazon Textract asynchronous operation that analyzes text in a lending document.
You start asynchronous text analysis by calling StartLendingAnalysis
, which returns a job identifier (JobId
). When the text analysis operation finishes, Amazon Textract publishes a completion status to the Amazon Simple Notification Service (Amazon SNS) topic that's registered in the initial call to StartLendingAnalysis
.
To get the results of the text analysis operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED. If so, call GetLendingAnalysis, and pass the job identifier (JobId
) from the initial call to StartLendingAnalysis
.
Service Reference:
Examples:
Calling the getLendingAnalysis operation
var params = {
JobId: 'STRING_VALUE', /* required */
MaxResults: 'NUMBER_VALUE',
NextToken: 'STRING_VALUE'
};
textract.getLendingAnalysis(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
JobId
— (String
)A unique identifier for the lending or text-detection job. The
JobId
is returned fromStartLendingAnalysis
. AJobId
value is only valid for 7 days.MaxResults
— (Integer
)The maximum number of results to return per paginated call. The largest value that you can specify is 30. If you specify a value greater than 30, a maximum of 30 results is returned. The default value is 30.
NextToken
— (String
)If the previous response was incomplete, Amazon Textract returns a pagination token in the response. You can use this pagination token to retrieve the next set of lending results.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:DocumentMetadata
— (map
)Information about the input document.
Pages
— (Integer
)The number of pages that are detected in the document.
JobStatus
— (String
)The current status of the lending analysis job.
Possible values include:"IN_PROGRESS"
"SUCCEEDED"
"FAILED"
"PARTIAL_SUCCESS"
NextToken
— (String
)If the response is truncated, Amazon Textract returns this token. You can use this token in the subsequent request to retrieve the next set of lending results.
Results
— (Array<map>
)Holds the information returned by one of AmazonTextract's document analysis operations for the pinstripe.
Page
— (Integer
)The page number for a page, with regard to whole submission.
PageClassification
— (map
)The classifier result for a given page.
PageType
— required — (Array<map>
)The class, or document type, assigned to a detected Page object. The class, or document type, assigned to a detected Page object.
Value
— (String
)The predicted value of a detected object.
Confidence
— (Float
)Amazon Textract's confidence in its predicted value.
PageNumber
— required — (Array<map>
)The page number the value was detected on, relative to Amazon Textract's starting position.
Value
— (String
)The predicted value of a detected object.
Confidence
— (Float
)Amazon Textract's confidence in its predicted value.
Extractions
— (Array<map>
)An array of Extraction to hold structured data. e.g. normalized key value pairs instead of raw OCR detections .
LendingDocument
— (map
)Holds the structured data returned by AnalyzeDocument for lending documents.
LendingFields
— (Array<map>
)An array of LendingField objects.
Type
— (String
)The type of the lending document.
KeyDetection
— (map
)The results extracted for a lending document.
Text
— (String
)The text extracted for a detected value in a lending document.
SelectionStatus
— (String
)The selection status of a selection element, such as an option button or check box.
Possible values include:"SELECTED"
"NOT_SELECTED"
Geometry
— (map
)Information about where the following items are located on a document page: detected page, text, key-value pairs, tables, table cells, and selection elements.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Confidence
— (Float
)The confidence level for the text of a detected value in a lending document.
ValueDetections
— (Array<map>
)An array of LendingDetection objects.
Text
— (String
)The text extracted for a detected value in a lending document.
SelectionStatus
— (String
)The selection status of a selection element, such as an option button or check box.
Possible values include:"SELECTED"
"NOT_SELECTED"
Geometry
— (map
)Information about where the following items are located on a document page: detected page, text, key-value pairs, tables, table cells, and selection elements.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Confidence
— (Float
)The confidence level for the text of a detected value in a lending document.
SignatureDetections
— (Array<map>
)A list of signatures detected in a lending document.
Confidence
— (Float
)The confidence, from 0 to 100, in the predicted values for a detected signature.
Geometry
— (map
)Information about where the following items are located on a document page: detected page, text, key-value pairs, tables, table cells, and selection elements.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
ExpenseDocument
— (map
)The structure holding all the information returned by AnalyzeExpense
ExpenseIndex
— (Integer
)Denotes which invoice or receipt in the document the information is coming from. First document will be 1, the second 2, and so on.
SummaryFields
— (Array<map>
)Any information found outside of a table by Amazon Textract.
Type
— (map
)The implied label of a detected element. Present alongside LabelDetection for explicit elements.
Text
— (String
)The word or line of text detected by Amazon Textract.
Confidence
— (Float
)The confidence of accuracy, as a percentage.
LabelDetection
— (map
)The explicitly stated label of a detected element.
Text
— (String
)The word or line of text recognized by Amazon Textract
Geometry
— (map
)Information about where the following items are located on a document page: detected page, text, key-value pairs, tables, table cells, and selection elements.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Confidence
— (Float
)The confidence in detection, as a percentage
ValueDetection
— (map
)The value of a detected element. Present in explicit and implicit elements.
Text
— (String
)The word or line of text recognized by Amazon Textract
Geometry
— (map
)Information about where the following items are located on a document page: detected page, text, key-value pairs, tables, table cells, and selection elements.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Confidence
— (Float
)The confidence in detection, as a percentage
PageNumber
— (Integer
)The page number the value was detected on.
Currency
— (map
)Shows the kind of currency, both the code and confidence associated with any monatary value detected.
Code
— (String
)Currency code for detected currency. the current supported codes are:
-
USD
-
EUR
-
GBP
-
CAD
-
INR
-
JPY
-
CHF
-
AUD
-
CNY
-
BZR
-
SEK
-
HKD
-
Confidence
— (Float
)Percentage confideence in the detected currency.
GroupProperties
— (Array<map>
)Shows which group a response object belongs to, such as whether an address line belongs to the vendor's address or the recipent's address.
Types
— (Array<String>
)Informs you on whether the expense group is a name or an address.
Id
— (String
)Provides a group Id number, which will be the same for each in the group.
LineItemGroups
— (Array<map>
)Information detected on each table of a document, seperated into
LineItems
.LineItemGroupIndex
— (Integer
)The number used to identify a specific table in a document. The first table encountered will have a LineItemGroupIndex of 1, the second 2, etc.
LineItems
— (Array<map>
)The breakdown of information on a particular line of a table.
LineItemExpenseFields
— (Array<map>
)ExpenseFields used to show information from detected lines on a table.
Type
— (map
)The implied label of a detected element. Present alongside LabelDetection for explicit elements.
Text
— (String
)The word or line of text detected by Amazon Textract.
Confidence
— (Float
)The confidence of accuracy, as a percentage.
LabelDetection
— (map
)The explicitly stated label of a detected element.
Text
— (String
)The word or line of text recognized by Amazon Textract
Geometry
— (map
)Information about where the following items are located on a document page: detected page, text, key-value pairs, tables, table cells, and selection elements.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Confidence
— (Float
)The confidence in detection, as a percentage
ValueDetection
— (map
)The value of a detected element. Present in explicit and implicit elements.
Text
— (String
)The word or line of text recognized by Amazon Textract
Geometry
— (map
)Information about where the following items are located on a document page: detected page, text, key-value pairs, tables, table cells, and selection elements.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Confidence
— (Float
)The confidence in detection, as a percentage
PageNumber
— (Integer
)The page number the value was detected on.
Currency
— (map
)Shows the kind of currency, both the code and confidence associated with any monatary value detected.
Code
— (String
)Currency code for detected currency. the current supported codes are:
-
USD
-
EUR
-
GBP
-
CAD
-
INR
-
JPY
-
CHF
-
AUD
-
CNY
-
BZR
-
SEK
-
HKD
-
Confidence
— (Float
)Percentage confideence in the detected currency.
GroupProperties
— (Array<map>
)Shows which group a response object belongs to, such as whether an address line belongs to the vendor's address or the recipent's address.
Types
— (Array<String>
)Informs you on whether the expense group is a name or an address.
Id
— (String
)Provides a group Id number, which will be the same for each in the group.
Blocks
— (Array<map>
)This is a block object, the same as reported when DetectDocumentText is run on a document. It provides word level recognition of text.
BlockType
— (String
)The type of text item that's recognized. In operations for text detection, the following types are returned:
-
PAGE - Contains a list of the LINE
Block
objects that are detected on a document page. -
WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
In text analysis operations, the following types are returned:
-
PAGE - Contains a list of child
Block
objects that are detected on a document page. -
KEY_VALUE_SET - Stores the KEY and VALUE
Block
objects for linked text that's detected on a document page. Use theEntityType
field to determine if a KEY_VALUE_SET object is a KEYBlock
object or a VALUEBlock
object. -
WORD - A word that's detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
-
TABLE - A table that's detected on a document page. A table is grid-based information with two or more rows or columns, with a cell span of one row and one column each.
-
TABLE_TITLE - The title of a table. A title is typically a line of text above or below a table, or embedded as the first row of a table.
-
TABLE_FOOTER - The footer associated with a table. A footer is typically a line or lines of text below a table or embedded as the last row of a table.
-
CELL - A cell within a detected table. The cell is the parent of the block that contains the text in the cell.
-
MERGED_CELL - A cell in a table whose content spans more than one row or column. The
Relationships
array for this cell contain data from individual cells. -
SELECTION_ELEMENT - A selection element such as an option button (radio button) or a check box that's detected on a document page. Use the value of
SelectionStatus
to determine the status of the selection element. -
SIGNATURE - The location and confidence score of a signature detected on a document page. Can be returned as part of a Key-Value pair or a detected cell.
-
QUERY - A question asked during the call of AnalyzeDocument. Contains an alias and an ID that attaches it to its answer.
-
QUERY_RESULT - A response to a question asked during the call of analyze document. Comes with an alias and ID for ease of locating in a response. Also contains location and confidence score.
The following BlockTypes are only returned for Amazon Textract Layout.
-
LAYOUT_TITLE
- The main title of the document. -
LAYOUT_HEADER
- Text located in the top margin of the document. -
LAYOUT_FOOTER
- Text located in the bottom margin of the document. -
LAYOUT_SECTION_HEADER
- The titles of sections within a document. -
LAYOUT_PAGE_NUMBER
- The page number of the documents. -
LAYOUT_LIST
- Any information grouped together in list form. -
LAYOUT_FIGURE
- Indicates the location of an image in a document. -
LAYOUT_TABLE
- Indicates the location of a table in the document. -
LAYOUT_KEY_VALUE
- Indicates the location of form key-values in a document. -
LAYOUT_TEXT
- Text that is present typically as a part of paragraphs in documents.
"KEY_VALUE_SET"
"PAGE"
"LINE"
"WORD"
"TABLE"
"CELL"
"SELECTION_ELEMENT"
"MERGED_CELL"
"TITLE"
"QUERY"
"QUERY_RESULT"
"SIGNATURE"
"TABLE_TITLE"
"TABLE_FOOTER"
"LAYOUT_TEXT"
"LAYOUT_TITLE"
"LAYOUT_HEADER"
"LAYOUT_FOOTER"
"LAYOUT_SECTION_HEADER"
"LAYOUT_PAGE_NUMBER"
"LAYOUT_LIST"
"LAYOUT_FIGURE"
"LAYOUT_TABLE"
"LAYOUT_KEY_VALUE"
-
Confidence
— (Float
)The confidence score that Amazon Textract has in the accuracy of the recognized text and the accuracy of the geometry points around the recognized text.
Text
— (String
)The word or line of text that's recognized by Amazon Textract.
TextType
— (String
)The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
Possible values include:"HANDWRITING"
"PRINTED"
RowIndex
— (Integer
)The row in which a table cell is located. The first row position is 1.
RowIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnIndex
— (Integer
)The column in which a table cell appears. The first column position is 1.
ColumnIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.RowSpan
— (Integer
)The number of rows that a table cell spans.
RowSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnSpan
— (Integer
)The number of columns that a table cell spans.
ColumnSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.Geometry
— (map
)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.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Id
— (String
)The identifier for the recognized text. The identifier is only unique for a single operation.
Relationships
— (Array<map>
)A list of relationship objects that describe how blocks are related to each other. For example, a LINE block object contains a CHILD relationship type with the WORD blocks that make up 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.
Type
— (String
)The type of relationship between the blocks in the IDs array and the current block. The following list describes the relationship types that can be returned.
-
VALUE - A list that contains the ID of the VALUE block that's associated with the KEY of a key-value pair.
-
CHILD - A list of IDs that identify blocks found within the current block object. For example, WORD blocks have a CHILD relationship to the LINE block type.
-
MERGED_CELL - A list of IDs that identify each of the MERGED_CELL block types in a table.
-
ANSWER - A list that contains the ID of the QUERY_RESULT block that’s associated with the corresponding QUERY block.
-
TABLE - A list of IDs that identify associated TABLE block types.
-
TABLE_TITLE - A list that contains the ID for the TABLE_TITLE block type in a table.
-
TABLE_FOOTER - A list of IDs that identify the TABLE_FOOTER block types in a table.
"VALUE"
"CHILD"
"COMPLEX_FEATURES"
"MERGED_CELL"
"TITLE"
"ANSWER"
"TABLE"
"TABLE_TITLE"
"TABLE_FOOTER"
-
Ids
— (Array<String>
)An array of IDs for related blocks. You can get the type of the relationship from the
Type
element.
EntityTypes
— (Array<String>
)The type of entity.
The following entity types can be returned by FORMS analysis:
-
KEY - An identifier for a field on the document.
-
VALUE - The field text.
The following entity types can be returned by TABLES analysis:
-
COLUMN_HEADER - Identifies a cell that is a header of a column.
-
TABLE_TITLE - Identifies a cell that is a title within the table.
-
TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section title is a cell that typically spans an entire row above a section.
-
TABLE_FOOTER - Identifies a cell that is a footer of a table.
-
TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an additional, smaller table that contains summary information for another table.
-
STRUCTURED_TABLE - Identifies a table with column headers where the content of each row corresponds to the headers.
-
SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
EntityTypes
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.-
SelectionStatus
— (String
)The selection status of a selection element, such as an option button or check box.
Possible values include:"SELECTED"
"NOT_SELECTED"
Page
— (Integer
)The page on which a block was detected.
Page
is returned by synchronous and asynchronous operations. Page values greater than 1 are only returned for multipage documents that are in PDF or TIFF format. A scanned image (JPEG/PNG) provided to an asynchronous operation, even if it contains multiple document pages, is considered a single-page document. This means that for scanned images the value ofPage
is always 1.Query
— (map
)Text
— required — (String
)Question that Amazon Textract will apply to the document. An example would be "What is the customer's SSN?"
Alias
— (String
)Alias attached to the query, for ease of location.
Pages
— (Array<String>
)Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter.
-
If a page is not specified, it is set to
["1"]
by default. -
The following characters are allowed in the parameter's string:
0 1 2 3 4 5 6 7 8 9 - *
. No whitespace is allowed. -
When using * to indicate all pages, it must be the only element in the list.
-
You can use page intervals, such as
[“1-3”, “1-1”, “4-*”]
. Where*
indicates last page of document. -
Specified pages must be greater than 0 and less than or equal to the number of pages in the document.
-
IdentityDocument
— (map
)The structure that lists each document processed in an AnalyzeID operation.
DocumentIndex
— (Integer
)Denotes the placement of a document in the IdentityDocument list. The first document is marked 1, the second 2 and so on.
IdentityDocumentFields
— (Array<map>
)The structure used to record information extracted from identity documents. Contains both normalized field and value of the extracted text.
Type
— (map
)Used to contain the information detected by an AnalyzeID operation.
Text
— required — (String
)Text of either the normalized field or value associated with it.
NormalizedValue
— (map
)Only returned for dates, returns the type of value detected and the date written in a more machine readable way.
Value
— (String
)The value of the date, written as Year-Month-DayTHour:Minute:Second.
ValueType
— (String
)The normalized type of the value detected. In this case, DATE.
Possible values include:"DATE"
Confidence
— (Float
)The confidence score of the detected text.
ValueDetection
— (map
)Used to contain the information detected by an AnalyzeID operation.
Text
— required — (String
)Text of either the normalized field or value associated with it.
NormalizedValue
— (map
)Only returned for dates, returns the type of value detected and the date written in a more machine readable way.
Value
— (String
)The value of the date, written as Year-Month-DayTHour:Minute:Second.
ValueType
— (String
)The normalized type of the value detected. In this case, DATE.
Possible values include:"DATE"
Confidence
— (Float
)The confidence score of the detected text.
Blocks
— (Array<map>
)Individual word recognition, as returned by document detection.
BlockType
— (String
)The type of text item that's recognized. In operations for text detection, the following types are returned:
-
PAGE - Contains a list of the LINE
Block
objects that are detected on a document page. -
WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
In text analysis operations, the following types are returned:
-
PAGE - Contains a list of child
Block
objects that are detected on a document page. -
KEY_VALUE_SET - Stores the KEY and VALUE
Block
objects for linked text that's detected on a document page. Use theEntityType
field to determine if a KEY_VALUE_SET object is a KEYBlock
object or a VALUEBlock
object. -
WORD - A word that's detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces.
-
LINE - A string of tab-delimited, contiguous words that are detected on a document page.
-
TABLE - A table that's detected on a document page. A table is grid-based information with two or more rows or columns, with a cell span of one row and one column each.
-
TABLE_TITLE - The title of a table. A title is typically a line of text above or below a table, or embedded as the first row of a table.
-
TABLE_FOOTER - The footer associated with a table. A footer is typically a line or lines of text below a table or embedded as the last row of a table.
-
CELL - A cell within a detected table. The cell is the parent of the block that contains the text in the cell.
-
MERGED_CELL - A cell in a table whose content spans more than one row or column. The
Relationships
array for this cell contain data from individual cells. -
SELECTION_ELEMENT - A selection element such as an option button (radio button) or a check box that's detected on a document page. Use the value of
SelectionStatus
to determine the status of the selection element. -
SIGNATURE - The location and confidence score of a signature detected on a document page. Can be returned as part of a Key-Value pair or a detected cell.
-
QUERY - A question asked during the call of AnalyzeDocument. Contains an alias and an ID that attaches it to its answer.
-
QUERY_RESULT - A response to a question asked during the call of analyze document. Comes with an alias and ID for ease of locating in a response. Also contains location and confidence score.
The following BlockTypes are only returned for Amazon Textract Layout.
-
LAYOUT_TITLE
- The main title of the document. -
LAYOUT_HEADER
- Text located in the top margin of the document. -
LAYOUT_FOOTER
- Text located in the bottom margin of the document. -
LAYOUT_SECTION_HEADER
- The titles of sections within a document. -
LAYOUT_PAGE_NUMBER
- The page number of the documents. -
LAYOUT_LIST
- Any information grouped together in list form. -
LAYOUT_FIGURE
- Indicates the location of an image in a document. -
LAYOUT_TABLE
- Indicates the location of a table in the document. -
LAYOUT_KEY_VALUE
- Indicates the location of form key-values in a document. -
LAYOUT_TEXT
- Text that is present typically as a part of paragraphs in documents.
"KEY_VALUE_SET"
"PAGE"
"LINE"
"WORD"
"TABLE"
"CELL"
"SELECTION_ELEMENT"
"MERGED_CELL"
"TITLE"
"QUERY"
"QUERY_RESULT"
"SIGNATURE"
"TABLE_TITLE"
"TABLE_FOOTER"
"LAYOUT_TEXT"
"LAYOUT_TITLE"
"LAYOUT_HEADER"
"LAYOUT_FOOTER"
"LAYOUT_SECTION_HEADER"
"LAYOUT_PAGE_NUMBER"
"LAYOUT_LIST"
"LAYOUT_FIGURE"
"LAYOUT_TABLE"
"LAYOUT_KEY_VALUE"
-
Confidence
— (Float
)The confidence score that Amazon Textract has in the accuracy of the recognized text and the accuracy of the geometry points around the recognized text.
Text
— (String
)The word or line of text that's recognized by Amazon Textract.
TextType
— (String
)The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text.
Possible values include:"HANDWRITING"
"PRINTED"
RowIndex
— (Integer
)The row in which a table cell is located. The first row position is 1.
RowIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnIndex
— (Integer
)The column in which a table cell appears. The first column position is 1.
ColumnIndex
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.RowSpan
— (Integer
)The number of rows that a table cell spans.
RowSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.ColumnSpan
— (Integer
)The number of columns that a table cell spans.
ColumnSpan
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.Geometry
— (map
)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.
BoundingBox
— (map
)An axis-aligned coarse representation of the location of the recognized item on the document page.
Width
— (Float
)The width of the bounding box as a ratio of the overall document page width.
Height
— (Float
)The height of the bounding box as a ratio of the overall document page height.
Left
— (Float
)The left coordinate of the bounding box as a ratio of overall document page width.
Top
— (Float
)The top coordinate of the bounding box as a ratio of overall document page height.
Polygon
— (Array<map>
)Within the bounding box, a fine-grained polygon around the recognized item.
X
— (Float
)The value of the X coordinate for a point on a
Polygon
.Y
— (Float
)The value of the Y coordinate for a point on a
Polygon
.
Id
— (String
)The identifier for the recognized text. The identifier is only unique for a single operation.
Relationships
— (Array<map>
)A list of relationship objects that describe how blocks are related to each other. For example, a LINE block object contains a CHILD relationship type with the WORD blocks that make up 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.
Type
— (String
)The type of relationship between the blocks in the IDs array and the current block. The following list describes the relationship types that can be returned.
-
VALUE - A list that contains the ID of the VALUE block that's associated with the KEY of a key-value pair.
-
CHILD - A list of IDs that identify blocks found within the current block object. For example, WORD blocks have a CHILD relationship to the LINE block type.
-
MERGED_CELL - A list of IDs that identify each of the MERGED_CELL block types in a table.
-
ANSWER - A list that contains the ID of the QUERY_RESULT block that’s associated with the corresponding QUERY block.
-
TABLE - A list of IDs that identify associated TABLE block types.
-
TABLE_TITLE - A list that contains the ID for the TABLE_TITLE block type in a table.
-
TABLE_FOOTER - A list of IDs that identify the TABLE_FOOTER block types in a table.
"VALUE"
"CHILD"
"COMPLEX_FEATURES"
"MERGED_CELL"
"TITLE"
"ANSWER"
"TABLE"
"TABLE_TITLE"
"TABLE_FOOTER"
-
Ids
— (Array<String>
)An array of IDs for related blocks. You can get the type of the relationship from the
Type
element.
EntityTypes
— (Array<String>
)The type of entity.
The following entity types can be returned by FORMS analysis:
-
KEY - An identifier for a field on the document.
-
VALUE - The field text.
The following entity types can be returned by TABLES analysis:
-
COLUMN_HEADER - Identifies a cell that is a header of a column.
-
TABLE_TITLE - Identifies a cell that is a title within the table.
-
TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section title is a cell that typically spans an entire row above a section.
-
TABLE_FOOTER - Identifies a cell that is a footer of a table.
-
TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be a row of a table or an additional, smaller table that contains summary information for another table.
-
STRUCTURED_TABLE - Identifies a table with column headers where the content of each row corresponds to the headers.
-
SEMI_STRUCTURED_TABLE - Identifies a non-structured table.
EntityTypes
isn't returned byDetectDocumentText
andGetDocumentTextDetection
.-
SelectionStatus
— (String
)The selection status of a selection element, such as an option button or check box.
Possible values include:"SELECTED"
"NOT_SELECTED"
Page
— (Integer
)The page on which a block was detected.
Page
is returned by synchronous and asynchronous operations. Page values greater than 1 are only returned for multipage documents that are in PDF or TIFF format. A scanned image (JPEG/PNG) provided to an asynchronous operation, even if it contains multiple document pages, is considered a single-page document. This means that for scanned images the value ofPage
is always 1.Query
— (map
)Text
— required — (String
)Question that Amazon Textract will apply to the document. An example would be "What is the customer's SSN?"
Alias
— (String
)Alias attached to the query, for ease of location.
Pages
— (Array<String>
)Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter.
-
If a page is not specified, it is set to
["1"]
by default. -
The following characters are allowed in the parameter's string:
0 1 2 3 4 5 6 7 8 9 - *
. No whitespace is allowed. -
When using * to indicate all pages, it must be the only element in the list.
-
You can use page intervals, such as
[“1-3”, “1-1”, “4-*”]
. Where*
indicates last page of document. -
Specified pages must be greater than 0 and less than or equal to the number of pages in the document.
-
Warnings
— (Array<map>
)A list of warnings that occurred during the lending analysis operation.
ErrorCode
— (String
)The error code for the warning.
Pages
— (Array<Integer>
)A list of the pages that the warning applies to.
StatusMessage
— (String
)Returns if the lending analysis job could not be completed. Contains explanation for what error occurred.
AnalyzeLendingModelVersion
— (String
)The current model version of the Analyze Lending API.
-
(AWS.Response)
—
Returns:
getLendingAnalysisSummary(params = {}, callback) ⇒ AWS.Request
Gets summarized results for the StartLendingAnalysis
operation, which analyzes text in a lending document. The returned summary consists of information about documents grouped together by a common document type. Information like detected signatures, page numbers, and split documents is returned with respect to the type of grouped document.
You start asynchronous text analysis by calling StartLendingAnalysis
, which returns a job identifier (JobId
). When the text analysis operation finishes, Amazon Textract publishes a completion status to the Amazon Simple Notification Service (Amazon SNS) topic that's registered in the initial call to StartLendingAnalysis
.
To get the results of the text analysis operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED. If so, call GetLendingAnalysisSummary
, and pass the job identifier (JobId
) from the initial call to StartLendingAnalysis
.
Service Reference:
Examples:
Calling the getLendingAnalysisSummary operation
var params = {
JobId: 'STRING_VALUE' /* required */
};
textract.getLendingAnalysisSummary(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
JobId
— (String
)A unique identifier for the lending or text-detection job. The
JobId
is returned from StartLendingAnalysis. AJobId
value is only valid for 7 days.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:DocumentMetadata
— (map
)Information about the input document.
Pages
— (Integer
)The number of pages that are detected in the document.
JobStatus
— (String
)The current status of the lending analysis job.
Possible values include:"IN_PROGRESS"
"SUCCEEDED"
"FAILED"
"PARTIAL_SUCCESS"
Summary
— (map
)Contains summary information for documents grouped by type.
DocumentGroups
— (Array<map>
)Contains an array of all DocumentGroup objects.
Type
— (String
)The type of document that Amazon Textract has detected. See Analyze Lending Response Objects for a list of all types returned by Textract.
SplitDocuments
— (Array<map>
)An array that contains information about the pages of a document, defined by logical boundary.
Index
— (Integer
)The index for a given document in a DocumentGroup of a specific Type.
Pages
— (Array<Integer>
)An array of page numbers for a for a given document, ordered by logical boundary.
DetectedSignatures
— (Array<map>
)A list of the detected signatures found in a document group.
Page
— (Integer
)The page a detected signature was found on.
UndetectedSignatures
— (Array<map>
)A list of any expected signatures not found in a document group.
Page
— (Integer
)The page where a signature was expected but not found.
UndetectedDocumentTypes
— (Array<String>
)UndetectedDocumentTypes.
Warnings
— (Array<map>
)A list of warnings that occurred during the lending analysis operation.
ErrorCode
— (String
)The error code for the warning.
Pages
— (Array<Integer>
)A list of the pages that the warning applies to.
StatusMessage
— (String
)Returns if the lending analysis could not be completed. Contains explanation for what error occurred.
AnalyzeLendingModelVersion
— (String
)The current model version of the Analyze Lending API.
-
(AWS.Response)
—
Returns:
listAdapters(params = {}, callback) ⇒ AWS.Request
Lists all adapters that match the specified filtration criteria.
Service Reference:
Examples:
Calling the listAdapters operation
var params = {
AfterCreationTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
BeforeCreationTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
MaxResults: 'NUMBER_VALUE',
NextToken: 'STRING_VALUE'
};
textract.listAdapters(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
AfterCreationTime
— (Date
)Specifies the lower bound for the ListAdapters operation. Ensures ListAdapters returns only adapters created after the specified creation time.
BeforeCreationTime
— (Date
)Specifies the upper bound for the ListAdapters operation. Ensures ListAdapters returns only adapters created before the specified creation time.
MaxResults
— (Integer
)The maximum number of results to return when listing adapters.
NextToken
— (String
)Identifies the next page of results to return when listing adapters.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:Adapters
— (Array<map>
)A list of adapters that matches the filtering criteria specified when calling ListAdapters.
AdapterId
— (String
)A unique identifier for the adapter resource.
AdapterName
— (String
)A string naming the adapter resource.
CreationTime
— (Date
)The date and time that the adapter was created.
FeatureTypes
— (Array<String>
)The feature types that the adapter is operating on.
NextToken
— (String
)Identifies the next page of results to return when listing adapters.
-
(AWS.Response)
—
Returns:
listAdapterVersions(params = {}, callback) ⇒ AWS.Request
List all version of an adapter that meet the specified filtration criteria.
Service Reference:
Examples:
Calling the listAdapterVersions operation
var params = {
AdapterId: 'STRING_VALUE',
AfterCreationTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
BeforeCreationTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
MaxResults: 'NUMBER_VALUE',
NextToken: 'STRING_VALUE'
};
textract.listAdapterVersions(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
AdapterId
— (String
)A string containing a unique ID for the adapter to match for when listing adapter versions.
AfterCreationTime
— (Date
)Specifies the lower bound for the ListAdapterVersions operation. Ensures ListAdapterVersions returns only adapter versions created after the specified creation time.
BeforeCreationTime
— (Date
)Specifies the upper bound for the ListAdapterVersions operation. Ensures ListAdapterVersions returns only adapter versions created after the specified creation time.
MaxResults
— (Integer
)The maximum number of results to return when listing adapter versions.
NextToken
— (String
)Identifies the next page of results to return when listing adapter versions.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:AdapterVersions
— (Array<map>
)Adapter versions that match the filtering criteria specified when calling ListAdapters.
AdapterId
— (String
)A unique identifier for the adapter associated with a given adapter version.
AdapterVersion
— (String
)An identified for a given adapter version.
CreationTime
— (Date
)The date and time that a given adapter version was created.
FeatureTypes
— (Array<String>
)The feature types that the adapter version is operating on.
Status
— (String
)Contains information on the status of a given adapter version.
Possible values include:"ACTIVE"
"AT_RISK"
"DEPRECATED"
"CREATION_ERROR"
"CREATION_IN_PROGRESS"
StatusMessage
— (String
)A message explaining the status of a given adapter vesion.
NextToken
— (String
)Identifies the next page of results to return when listing adapter versions.
-
(AWS.Response)
—
Returns:
listTagsForResource(params = {}, callback) ⇒ AWS.Request
Lists all tags for an Amazon Textract resource.
Service Reference:
Examples:
Calling the listTagsForResource operation
var params = {
ResourceARN: 'STRING_VALUE' /* required */
};
textract.listTagsForResource(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
ResourceARN
— (String
)The Amazon Resource Name (ARN) that specifies the resource to list tags for.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:Tags
— (map<String>
)A set of tags (key-value pairs) that are part of the requested resource.
-
(AWS.Response)
—
Returns:
startDocumentAnalysis(params = {}, callback) ⇒ AWS.Request
Starts the asynchronous analysis of an input document for relationships between detected items such as key-value pairs, tables, and selection elements.
StartDocumentAnalysis
can analyze text in documents that are in JPEG, PNG, TIFF, and PDF format. The documents are stored in an Amazon S3 bucket. Use DocumentLocation to specify the bucket name and file name of the document.
StartDocumentAnalysis
returns a job identifier (JobId
) that you use to get the results of the operation. When text analysis is finished, Amazon Textract publishes a completion status to the Amazon Simple Notification Service (Amazon SNS) topic that you specify in NotificationChannel
. To get the results of the text analysis operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED
. If so, call GetDocumentAnalysis, and pass the job identifier (JobId
) from the initial call to StartDocumentAnalysis
.
For more information, see Document Text Analysis.
Service Reference:
Examples:
Calling the startDocumentAnalysis operation
var params = {
DocumentLocation: { /* required */
S3Object: {
Bucket: 'STRING_VALUE',
Name: 'STRING_VALUE',
Version: 'STRING_VALUE'
}
},
FeatureTypes: [ /* required */
TABLES | FORMS | QUERIES | SIGNATURES | LAYOUT,
/* more items */
],
AdaptersConfig: {
Adapters: [ /* required */
{
AdapterId: 'STRING_VALUE', /* required */
Version: 'STRING_VALUE', /* required */
Pages: [
'STRING_VALUE',
/* more items */
]
},
/* more items */
]
},
ClientRequestToken: 'STRING_VALUE',
JobTag: 'STRING_VALUE',
KMSKeyId: 'STRING_VALUE',
NotificationChannel: {
RoleArn: 'STRING_VALUE', /* required */
SNSTopicArn: 'STRING_VALUE' /* required */
},
OutputConfig: {
S3Bucket: 'STRING_VALUE', /* required */
S3Prefix: 'STRING_VALUE'
},
QueriesConfig: {
Queries: [ /* required */
{
Text: 'STRING_VALUE', /* required */
Alias: 'STRING_VALUE',
Pages: [
'STRING_VALUE',
/* more items */
]
},
/* more items */
]
}
};
textract.startDocumentAnalysis(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
DocumentLocation
— (map
)The location of the document to be processed.
S3Object
— (map
)The Amazon S3 bucket that contains the input document.
Bucket
— (String
)The name of the S3 bucket. Note that the # character is not valid in the file name.
Name
— (String
)The file name of the input document. Synchronous operations can use image files that are in JPEG or PNG format. Asynchronous operations also support PDF and TIFF format files.
Version
— (String
)If the bucket has versioning enabled, you can specify the object version.
FeatureTypes
— (Array<String>
)A list of the types of analysis to perform. Add TABLES to the list to return information about the tables that are detected in the input document. Add FORMS to return detected form data. To perform both types of analysis, add TABLES and FORMS to
FeatureTypes
. All lines and words detected in the document are included in the response (including text that isn't related to the value ofFeatureTypes
).ClientRequestToken
— (String
)The idempotent token that you use to identify the start request. If you use the same token with multiple
StartDocumentAnalysis
requests, the sameJobId
is returned. UseClientRequestToken
to prevent the same job from being accidentally started more than once. For more information, see Calling Amazon Textract Asynchronous Operations.JobTag
— (String
)An identifier that you specify that's included in the completion notification published to the Amazon SNS topic. For example, you can use
JobTag
to identify the type of document that the completion notification corresponds to (such as a tax form or a receipt).NotificationChannel
— (map
)The Amazon SNS topic ARN that you want Amazon Textract to publish the completion status of the operation to.
SNSTopicArn
— required — (String
)The Amazon SNS topic that Amazon Textract posts the completion status to.
RoleArn
— required — (String
)The Amazon Resource Name (ARN) of an IAM role that gives Amazon Textract publishing permissions to the Amazon SNS topic.
OutputConfig
— (map
)Sets if the output will go to a customer defined bucket. By default, Amazon Textract will save the results internally to be accessed by the GetDocumentAnalysis operation.
S3Bucket
— required — (String
)The name of the bucket your output will go to.
S3Prefix
— (String
)The prefix of the object key that the output will be saved to. When not enabled, the prefix will be “textract_output".
KMSKeyId
— (String
)The KMS key used to encrypt the inference results. This can be in either Key ID or Key Alias format. When a KMS key is provided, the KMS key will be used for server-side encryption of the objects in the customer bucket. When this parameter is not enabled, the result will be encrypted server side,using SSE-S3.
QueriesConfig
— (map
)Queries
— required — (Array<map>
)Text
— required — (String
)Question that Amazon Textract will apply to the document. An example would be "What is the customer's SSN?"
Alias
— (String
)Alias attached to the query, for ease of location.
Pages
— (Array<String>
)Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter.
-
If a page is not specified, it is set to
["1"]
by default. -
The following characters are allowed in the parameter's string:
0 1 2 3 4 5 6 7 8 9 - *
. No whitespace is allowed. -
When using * to indicate all pages, it must be the only element in the list.
-
You can use page intervals, such as
[“1-3”, “1-1”, “4-*”]
. Where*
indicates last page of document. -
Specified pages must be greater than 0 and less than or equal to the number of pages in the document.
-
AdaptersConfig
— (map
)Specifies the adapter to be used when analyzing a document.
Adapters
— required — (Array<map>
)A list of adapters to be used when analyzing the specified document.
AdapterId
— required — (String
)A unique identifier for the adapter resource.
Pages
— (Array<String>
)Pages is a parameter that the user inputs to specify which pages to apply an adapter to. The following is a list of rules for using this parameter.
-
If a page is not specified, it is set to
["1"]
by default. -
The following characters are allowed in the parameter's string:
0 1 2 3 4 5 6 7 8 9 - *
. No whitespace is allowed. -
When using * to indicate all pages, it must be the only element in the list.
-
You can use page intervals, such as
["1-3", "1-1", "4-*"]
. Where*
indicates last page of document. -
Specified pages must be greater than 0 and less than or equal to the number of pages in the document.
-
Version
— required — (String
)A string that identifies the version of the adapter.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:JobId
— (String
)The identifier for the document text detection job. Use
JobId
to identify the job in a subsequent call toGetDocumentAnalysis
. AJobId
value is only valid for 7 days.
-
(AWS.Response)
—
Returns:
startDocumentTextDetection(params = {}, callback) ⇒ AWS.Request
Starts the asynchronous detection of text in a document. Amazon Textract can detect lines of text and the words that make up a line of text.
StartDocumentTextDetection
can analyze text in documents that are in JPEG, PNG, TIFF, and PDF format. The documents are stored in an Amazon S3 bucket. Use DocumentLocation to specify the bucket name and file name of the document.
StartTextDetection
returns a job identifier (JobId
) that you use to get the results of the operation. When text detection is finished, Amazon Textract publishes a completion status to the Amazon Simple Notification Service (Amazon SNS) topic that you specify in NotificationChannel
. To get the results of the text detection operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED
. If so, call GetDocumentTextDetection, and pass the job identifier (JobId
) from the initial call to StartDocumentTextDetection
.
For more information, see Document Text Detection.
Service Reference:
Examples:
Calling the startDocumentTextDetection operation
var params = {
DocumentLocation: { /* required */
S3Object: {
Bucket: 'STRING_VALUE',
Name: 'STRING_VALUE',
Version: 'STRING_VALUE'
}
},
ClientRequestToken: 'STRING_VALUE',
JobTag: 'STRING_VALUE',
KMSKeyId: 'STRING_VALUE',
NotificationChannel: {
RoleArn: 'STRING_VALUE', /* required */
SNSTopicArn: 'STRING_VALUE' /* required */
},
OutputConfig: {
S3Bucket: 'STRING_VALUE', /* required */
S3Prefix: 'STRING_VALUE'
}
};
textract.startDocumentTextDetection(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
DocumentLocation
— (map
)The location of the document to be processed.
S3Object
— (map
)The Amazon S3 bucket that contains the input document.
Bucket
— (String
)The name of the S3 bucket. Note that the # character is not valid in the file name.
Name
— (String
)The file name of the input document. Synchronous operations can use image files that are in JPEG or PNG format. Asynchronous operations also support PDF and TIFF format files.
Version
— (String
)If the bucket has versioning enabled, you can specify the object version.
ClientRequestToken
— (String
)The idempotent token that's used to identify the start request. If you use the same token with multiple
StartDocumentTextDetection
requests, the sameJobId
is returned. UseClientRequestToken
to prevent the same job from being accidentally started more than once. For more information, see Calling Amazon Textract Asynchronous Operations.JobTag
— (String
)An identifier that you specify that's included in the completion notification published to the Amazon SNS topic. For example, you can use
JobTag
to identify the type of document that the completion notification corresponds to (such as a tax form or a receipt).NotificationChannel
— (map
)The Amazon SNS topic ARN that you want Amazon Textract to publish the completion status of the operation to.
SNSTopicArn
— required — (String
)The Amazon SNS topic that Amazon Textract posts the completion status to.
RoleArn
— required — (String
)The Amazon Resource Name (ARN) of an IAM role that gives Amazon Textract publishing permissions to the Amazon SNS topic.
OutputConfig
— (map
)Sets if the output will go to a customer defined bucket. By default Amazon Textract will save the results internally to be accessed with the GetDocumentTextDetection operation.
S3Bucket
— required — (String
)The name of the bucket your output will go to.
S3Prefix
— (String
)The prefix of the object key that the output will be saved to. When not enabled, the prefix will be “textract_output".
KMSKeyId
— (String
)The KMS key used to encrypt the inference results. This can be in either Key ID or Key Alias format. When a KMS key is provided, the KMS key will be used for server-side encryption of the objects in the customer bucket. When this parameter is not enabled, the result will be encrypted server side,using SSE-S3.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:JobId
— (String
)The identifier of the text detection job for the document. Use
JobId
to identify the job in a subsequent call toGetDocumentTextDetection
. AJobId
value is only valid for 7 days.
-
(AWS.Response)
—
Returns:
startExpenseAnalysis(params = {}, callback) ⇒ AWS.Request
Starts the asynchronous analysis of invoices or receipts for data like contact information, items purchased, and vendor names.
StartExpenseAnalysis
can analyze text in documents that are in JPEG, PNG, and PDF format. The documents must be stored in an Amazon S3 bucket. Use the DocumentLocation parameter to specify the name of your S3 bucket and the name of the document in that bucket.
StartExpenseAnalysis
returns a job identifier (JobId
) that you will provide to GetExpenseAnalysis
to retrieve the results of the operation. When the analysis of the input invoices/receipts is finished, Amazon Textract publishes a completion status to the Amazon Simple Notification Service (Amazon SNS) topic that you provide to the NotificationChannel
. To obtain the results of the invoice and receipt analysis operation, ensure that the status value published to the Amazon SNS topic is SUCCEEDED
. If so, call GetExpenseAnalysis, and pass the job identifier (JobId
) that was returned by your call to StartExpenseAnalysis
.
For more information, see Analyzing Invoices and Receipts.
Service Reference:
Examples:
Calling the startExpenseAnalysis operation
var params = {
DocumentLocation: { /* required */
S3Object: {
Bucket: 'STRING_VALUE',
Name: 'STRING_VALUE',
Version: 'STRING_VALUE'
}
},
ClientRequestToken: 'STRING_VALUE',
JobTag: 'STRING_VALUE',
KMSKeyId: 'STRING_VALUE',
NotificationChannel: {
RoleArn: 'STRING_VALUE', /* required */
SNSTopicArn: 'STRING_VALUE' /* required */
},
OutputConfig: {
S3Bucket: 'STRING_VALUE', /* required */
S3Prefix: 'STRING_VALUE'
}
};
textract.startExpenseAnalysis(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
DocumentLocation
— (map
)The location of the document to be processed.
S3Object
— (map
)The Amazon S3 bucket that contains the input document.
Bucket
— (String
)The name of the S3 bucket. Note that the # character is not valid in the file name.
Name
— (String
)The file name of the input document. Synchronous operations can use image files that are in JPEG or PNG format. Asynchronous operations also support PDF and TIFF format files.
Version
— (String
)If the bucket has versioning enabled, you can specify the object version.
ClientRequestToken
— (String
)The idempotent token that's used to identify the start request. If you use the same token with multiple
StartDocumentTextDetection
requests, the sameJobId
is returned. UseClientRequestToken
to prevent the same job from being accidentally started more than once. For more information, see Calling Amazon Textract Asynchronous OperationsJobTag
— (String
)An identifier you specify that's included in the completion notification published to the Amazon SNS topic. For example, you can use
JobTag
to identify the type of document that the completion notification corresponds to (such as a tax form or a receipt).NotificationChannel
— (map
)The Amazon SNS topic ARN that you want Amazon Textract to publish the completion status of the operation to.
SNSTopicArn
— required — (String
)The Amazon SNS topic that Amazon Textract posts the completion status to.
RoleArn
— required — (String
)The Amazon Resource Name (ARN) of an IAM role that gives Amazon Textract publishing permissions to the Amazon SNS topic.
OutputConfig
— (map
)Sets if the output will go to a customer defined bucket. By default, Amazon Textract will save the results internally to be accessed by the
GetExpenseAnalysis
operation.S3Bucket
— required — (String
)The name of the bucket your output will go to.
S3Prefix
— (String
)The prefix of the object key that the output will be saved to. When not enabled, the prefix will be “textract_output".
KMSKeyId
— (String
)The KMS key used to encrypt the inference results. This can be in either Key ID or Key Alias format. When a KMS key is provided, the KMS key will be used for server-side encryption of the objects in the customer bucket. When this parameter is not enabled, the result will be encrypted server side,using SSE-S3.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:JobId
— (String
)A unique identifier for the text detection job. The
JobId
is returned fromStartExpenseAnalysis
. AJobId
value is only valid for 7 days.
-
(AWS.Response)
—
Returns:
startLendingAnalysis(params = {}, callback) ⇒ AWS.Request
Starts the classification and analysis of an input document. StartLendingAnalysis
initiates the classification and analysis of a packet of lending documents. StartLendingAnalysis
operates on a document file located in an Amazon S3 bucket.
StartLendingAnalysis
can analyze text in documents that are in one of the following formats: JPEG, PNG, TIFF, PDF. Use DocumentLocation
to specify the bucket name and the file name of the document.
StartLendingAnalysis
returns a job identifier (JobId
) that you use to get the results of the operation. When the text analysis is finished, Amazon Textract publishes a completion status to the Amazon Simple Notification Service (Amazon SNS) topic that you specify in NotificationChannel
. To get the results of the text analysis operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED. If the status is SUCCEEDED you can call either GetLendingAnalysis
or GetLendingAnalysisSummary
and provide the JobId
to obtain the results of the analysis.
If using OutputConfig
to specify an Amazon S3 bucket, the output will be contained within the specified prefix in a directory labeled with the job-id. In the directory there are 3 sub-directories:
-
detailedResponse (contains the GetLendingAnalysis response)
-
summaryResponse (for the GetLendingAnalysisSummary response)
-
splitDocuments (documents split across logical boundaries)
Service Reference:
Examples:
Calling the startLendingAnalysis operation
var params = {
DocumentLocation: { /* required */
S3Object: {
Bucket: 'STRING_VALUE',
Name: 'STRING_VALUE',
Version: 'STRING_VALUE'
}
},
ClientRequestToken: 'STRING_VALUE',
JobTag: 'STRING_VALUE',
KMSKeyId: 'STRING_VALUE',
NotificationChannel: {
RoleArn: 'STRING_VALUE', /* required */
SNSTopicArn: 'STRING_VALUE' /* required */
},
OutputConfig: {
S3Bucket: 'STRING_VALUE', /* required */
S3Prefix: 'STRING_VALUE'
}
};
textract.startLendingAnalysis(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
DocumentLocation
— (map
)The Amazon S3 bucket that contains the document to be processed. It's used by asynchronous operations.
The input document can be an image file in JPEG or PNG format. It can also be a file in PDF format.
S3Object
— (map
)The Amazon S3 bucket that contains the input document.
Bucket
— (String
)The name of the S3 bucket. Note that the # character is not valid in the file name.
Name
— (String
)The file name of the input document. Synchronous operations can use image files that are in JPEG or PNG format. Asynchronous operations also support PDF and TIFF format files.
Version
— (String
)If the bucket has versioning enabled, you can specify the object version.
ClientRequestToken
— (String
)The idempotent token that you use to identify the start request. If you use the same token with multiple
StartLendingAnalysis
requests, the sameJobId
is returned. UseClientRequestToken
to prevent the same job from being accidentally started more than once. For more information, see Calling Amazon Textract Asynchronous Operations.JobTag
— (String
)An identifier that you specify to be included in the completion notification published to the Amazon SNS topic. For example, you can use
JobTag
to identify the type of document that the completion notification corresponds to (such as a tax form or a receipt).NotificationChannel
— (map
)The Amazon Simple Notification Service (Amazon SNS) topic to which Amazon Textract publishes the completion status of an asynchronous document operation.
SNSTopicArn
— required — (String
)The Amazon SNS topic that Amazon Textract posts the completion status to.
RoleArn
— required — (String
)The Amazon Resource Name (ARN) of an IAM role that gives Amazon Textract publishing permissions to the Amazon SNS topic.
OutputConfig
— (map
)Sets whether or not your output will go to a user created bucket. Used to set the name of the bucket, and the prefix on the output file.
OutputConfig
is an optional parameter which lets you adjust where your output will be placed. By default, Amazon Textract will store the results internally and can only be accessed by the Get API operations. WithOutputConfig
enabled, you can set the name of the bucket the output will be sent to the file prefix of the results where you can download your results. Additionally, you can set theKMSKeyID
parameter to a customer master key (CMK) to encrypt your output. Without this parameter set Amazon Textract will encrypt server-side using the AWS managed CMK for Amazon S3.Decryption of Customer Content is necessary for processing of the documents by Amazon Textract. If your account is opted out under an AI services opt out policy then all unencrypted Customer Content is immediately and permanently deleted after the Customer Content has been processed by the service. No copy of of the output is retained by Amazon Textract. For information about how to opt out, see Managing AI services opt-out policy.
For more information on data privacy, see the Data Privacy FAQ.
S3Bucket
— required — (String
)The name of the bucket your output will go to.
S3Prefix
— (String
)The prefix of the object key that the output will be saved to. When not enabled, the prefix will be “textract_output".
KMSKeyId
— (String
)The KMS key used to encrypt the inference results. This can be in either Key ID or Key Alias format. When a KMS key is provided, the KMS key will be used for server-side encryption of the objects in the customer bucket. When this parameter is not enabled, the result will be encrypted server side, using SSE-S3.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:JobId
— (String
)A unique identifier for the lending or text-detection job. The
JobId
is returned fromStartLendingAnalysis
. AJobId
value is only valid for 7 days.
-
(AWS.Response)
—
Returns:
tagResource(params = {}, callback) ⇒ AWS.Request
Adds one or more tags to the specified resource.
Service Reference:
Examples:
Calling the tagResource operation
var params = {
ResourceARN: 'STRING_VALUE', /* required */
Tags: { /* required */
'<TagKey>': 'STRING_VALUE',
/* '<TagKey>': ... */
}
};
textract.tagResource(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
ResourceARN
— (String
)The Amazon Resource Name (ARN) that specifies the resource to be tagged.
Tags
— (map<String>
)A set of tags (key-value pairs) that you want to assign to the resource.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs.
-
(AWS.Response)
—
Returns:
untagResource(params = {}, callback) ⇒ AWS.Request
Removes any tags with the specified keys from the specified resource.
Service Reference:
Examples:
Calling the untagResource operation
var params = {
ResourceARN: 'STRING_VALUE', /* required */
TagKeys: [ /* required */
'STRING_VALUE',
/* more items */
]
};
textract.untagResource(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
ResourceARN
— (String
)The Amazon Resource Name (ARN) that specifies the resource to be untagged.
TagKeys
— (Array<String>
)Specifies the tags to be removed from the resource specified by the ResourceARN.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs.
-
(AWS.Response)
—
Returns:
updateAdapter(params = {}, callback) ⇒ AWS.Request
Update the configuration for an adapter. FeatureTypes configurations cannot be updated. At least one new parameter must be specified as an argument.
Service Reference:
Examples:
Calling the updateAdapter operation
var params = {
AdapterId: 'STRING_VALUE', /* required */
AdapterName: 'STRING_VALUE',
AutoUpdate: ENABLED | DISABLED,
Description: 'STRING_VALUE'
};
textract.updateAdapter(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Parameters:
-
params
(Object)
(defaults to: {})
—
AdapterId
— (String
)A string containing a unique ID for the adapter that will be updated.
Description
— (String
)The new description to be applied to the adapter.
AdapterName
— (String
)The new name to be applied to the adapter.
AutoUpdate
— (String
)The new auto-update status to be applied to the adapter.
Possible values include:"ENABLED"
"DISABLED"
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs. Thedata
object has the following properties:AdapterId
— (String
)A string containing a unique ID for the adapter that has been updated.
AdapterName
— (String
)A string containing the name of the adapter that has been updated.
CreationTime
— (Date
)An object specifying the creation time of the the adapter that has been updated.
Description
— (String
)A string containing the description of the adapter that has been updated.
FeatureTypes
— (Array<String>
)List of the targeted feature types for the updated adapter.
AutoUpdate
— (String
)The auto-update status of the adapter that has been updated.
Possible values include:"ENABLED"
"DISABLED"
-
(AWS.Response)
—
Returns: