textract

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2019 License: Apache-2.0 Imports: 5 Imported by: 24

Documentation

Overview

Package textract provides the client and types for making API requests to Amazon Textract.

Amazon Textract detects and analyzes text in documents and converts it into machine-readable text. This is the API reference documentation for Amazon Textract.

See https://docs.aws.amazon.com/goto/WebAPI/textract-2018-06-27 for more information on this service.

See textract package documentation for more information. https://docs.aws.amazon.com/sdk-for-go/api/service/textract/

Using the Client

To use Amazon Textract with the SDK use the New function to create a new service client. With that client you can make API requests to the service. These clients are safe to use concurrently.

See the SDK's documentation for more information on how to use the SDK. https://docs.aws.amazon.com/sdk-for-go/api/

See aws.Config documentation for more information on configuring SDK clients. https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config

See the Amazon Textract client for more information on creating client for this service. https://docs.aws.amazon.com/sdk-for-go/api/service/textract/#New

Index

Constants

View Source
const (
	ServiceName = "Amazon Textract" // Service's name
	ServiceID   = "Textract"        // Service's identifier
	EndpointsID = "textract"        // Service's Endpoint identifier
)
View Source
const (

	// ErrCodeAccessDeniedException for service response error code
	// "AccessDeniedException".
	//
	// You aren't authorized to perform the action.
	ErrCodeAccessDeniedException = "AccessDeniedException"

	// ErrCodeBadDocumentException for service response error code
	// "BadDocumentException".
	//
	// Amazon Textract isn't able to read the document.
	ErrCodeBadDocumentException = "BadDocumentException"

	// ErrCodeDocumentTooLargeException for service response error code
	// "DocumentTooLargeException".
	//
	// The document can't be processed because it's too large. The maximum document
	// size for synchronous operations 5 MB. The maximum document size for asynchronous
	// operations is 500 MB for PDF format files.
	ErrCodeDocumentTooLargeException = "DocumentTooLargeException"

	// ErrCodeIdempotentParameterMismatchException for service response error code
	// "IdempotentParameterMismatchException".
	//
	// A ClientRequestToken input parameter was reused with an operation, but at
	// least one of the other input parameters is different from the previous call
	// to the operation.
	ErrCodeIdempotentParameterMismatchException = "IdempotentParameterMismatchException"

	// ErrCodeInternalServerError for service response error code
	// "InternalServerError".
	//
	// Amazon Textract experienced a service issue. Try your call again.
	ErrCodeInternalServerError = "InternalServerError"

	// ErrCodeInvalidJobIdException for service response error code
	// "InvalidJobIdException".
	//
	// An invalid job identifier was passed to GetDocumentAnalysis or to GetDocumentAnalysis.
	ErrCodeInvalidJobIdException = "InvalidJobIdException"

	// ErrCodeInvalidParameterException for service response error code
	// "InvalidParameterException".
	//
	// An input parameter violated a constraint. For example, in synchronous operations,
	// an InvalidParameterException exception occurs when neither of the S3Object
	// or Bytes values are supplied in the Document request parameter. Validate
	// your parameter before calling the API operation again.
	ErrCodeInvalidParameterException = "InvalidParameterException"

	// ErrCodeInvalidS3ObjectException for service response error code
	// "InvalidS3ObjectException".
	//
	// Amazon Textract is unable to access the S3 object that's specified in the
	// request.
	ErrCodeInvalidS3ObjectException = "InvalidS3ObjectException"

	// ErrCodeLimitExceededException for service response error code
	// "LimitExceededException".
	//
	// An Amazon Textract service limit was exceeded. For example, if you start
	// too many asynchronous jobs concurrently, calls to start operations (StartDocumentTextDetection,
	// for example) raise a LimitExceededException exception (HTTP status code:
	// 400) until the number of concurrently running jobs is below the Amazon Textract
	// service limit.
	ErrCodeLimitExceededException = "LimitExceededException"

	// ErrCodeProvisionedThroughputExceededException for service response error code
	// "ProvisionedThroughputExceededException".
	//
	// The number of requests exceeded your throughput limit. If you want to increase
	// this limit, contact Amazon Textract.
	ErrCodeProvisionedThroughputExceededException = "ProvisionedThroughputExceededException"

	// ErrCodeThrottlingException for service response error code
	// "ThrottlingException".
	//
	// Amazon Textract is temporarily unable to process the request. Try your call
	// again.
	ErrCodeThrottlingException = "ThrottlingException"

	// ErrCodeUnsupportedDocumentException for service response error code
	// "UnsupportedDocumentException".
	//
	// The format of the input document isn't supported. Amazon Textract supports
	// documents that are .png or .jpg format.
	ErrCodeUnsupportedDocumentException = "UnsupportedDocumentException"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyzeDocumentInput

type AnalyzeDocumentInput struct {

	// 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 JPG or PNG format.
	//
	// If you are using an AWS SDK to call Amazon Textract, you might not need to
	// base64-encode image bytes passed using the Bytes field.
	//
	// Document is a required field
	Document *Document `type:"structure" required:"true"`

	// A list of the types of analysis to perform. Add TABLES to the list to return
	// information about the tables detected in the input document. Add FORMS to
	// return detected fields and the associated text. To perform both types of
	// analysis, add TABLES and FORMS to FeatureTypes.
	//
	// FeatureTypes is a required field
	FeatureTypes []FeatureType `type:"list" required:"true"`
	// contains filtered or unexported fields
}

func (AnalyzeDocumentInput) String

func (s AnalyzeDocumentInput) String() string

String returns the string representation

func (*AnalyzeDocumentInput) Validate

func (s *AnalyzeDocumentInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type AnalyzeDocumentOutput

type AnalyzeDocumentOutput struct {

	// The text that's detected and analyzed by AnalyzeDocument.
	Blocks []Block `type:"list"`

	// Metadata about the analyzed document. An example is the number of pages.
	DocumentMetadata *DocumentMetadata `type:"structure"`
	// contains filtered or unexported fields
}

func (AnalyzeDocumentOutput) String

func (s AnalyzeDocumentOutput) String() string

String returns the string representation

type AnalyzeDocumentRequest

type AnalyzeDocumentRequest struct {
	*aws.Request
	Input *AnalyzeDocumentInput
	Copy  func(*AnalyzeDocumentInput) AnalyzeDocumentRequest
}

AnalyzeDocumentRequest is the request type for the AnalyzeDocument API operation.

func (AnalyzeDocumentRequest) Send

Send marshals and sends the AnalyzeDocument API request.

type AnalyzeDocumentResponse added in v0.9.0

type AnalyzeDocumentResponse struct {
	*AnalyzeDocumentOutput
	// contains filtered or unexported fields
}

AnalyzeDocumentResponse is the response type for the AnalyzeDocument API operation.

func (*AnalyzeDocumentResponse) SDKResponseMetdata added in v0.9.0

func (r *AnalyzeDocumentResponse) SDKResponseMetdata() *aws.Response

SDKResponseMetdata returns the response metadata for the AnalyzeDocument request.

type Block

type Block struct {

	// The type of text that's recognized in a block. In text-detection operations,
	// 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's 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 a field that's
	//    detected on a document page. Use the EntityType field to determine if
	//    a KEY_VALUE_SET object is a KEY Block object or a VALUE Block object.
	//
	//    * 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 that's detected
	//    on a document page.
	//
	//    * LINE - A string of tab-delimited, contiguous words that's detected on
	//    a document page.
	//
	//    * TABLE - A table that's detected on a document page. A table is any grid-based
	//    information with 2 or more rows or columns with a cell span of 1 row and
	//    1 column each.
	//
	//    * CELL - A cell within a detected table. The cell is the parent of the
	//    block that contains the text in the cell.
	//
	//    * SELECTION_ELEMENT - A selectable element such as a radio button or checkbox
	//    that's detected on a document page. Use the value of SelectionStatus to
	//    determine the status of the selection element.
	BlockType BlockType `type:"string" enum:"true"`

	// The column in which a table cell appears. The first column position is 1.
	// ColumnIndex isn't returned by DetectDocumentText and GetDocumentTextDetection.
	ColumnIndex *int64 `type:"integer"`

	// The number of columns that a table cell spans. ColumnSpan isn't returned
	// by DetectDocumentText and GetDocumentTextDetection.
	ColumnSpan *int64 `type:"integer"`

	// The confidence that Amazon Textract has in the accuracy of the recognized
	// text and the accuracy of the geometry points around the recognized text.
	Confidence *float64 `type:"float"`

	// The type of entity. The following can be returned:
	//
	//    * KEY - An identifier for a field on the document.
	//
	//    * VALUE - The field text.
	//
	// EntityTypes isn't returned by DetectDocumentText and GetDocumentTextDetection.
	EntityTypes []EntityType `type:"list"`

	// 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.
	Geometry *Geometry `type:"structure"`

	// The identifier for the recognized text. The identifier is only unique for
	// a single operation.
	Id *string `type:"string"`

	// The page in which a block was detected. Page is returned by asynchronous
	// operations. Page values greater than 1 are only returned for multi-page documents
	// that are in PDF format. A scanned image (JPG/PNG), even if it contains multiple
	// document pages, is always considered to be a single-page document and the
	// value of Page is always 1. Synchronous operations don't return Page as every
	// input document is considered to be a single-page document.
	Page *int64 `type:"integer"`

	// A list of child blocks of the current block. For example a LINE object has
	// child blocks for each WORD block that's part of the line of text. There aren't
	// Relationship objects in the list for relationships that don't exist, such
	// as when the current block has no child blocks. The list size can be the following:
	//
	//    * 0 - The block has no child blocks.
	//
	//    * 1 - The block has child blocks.
	Relationships []Relationship `type:"list"`

	// The row in which a table cell is located. The first row position is 1. RowIndex
	// isn't returned by DetectDocumentText and GetDocumentTextDetection.
	RowIndex *int64 `type:"integer"`

	// The number of rows that a table spans. RowSpan isn't returned by DetectDocumentText
	// and GetDocumentTextDetection.
	RowSpan *int64 `type:"integer"`

	// The selection status of a selectable element such as a radio button or checkbox.
	SelectionStatus SelectionStatus `type:"string" enum:"true"`

	// The word or line of text that's recognized by Amazon Textract.
	Text *string `type:"string"`
	// contains filtered or unexported fields
}

A Block represents items that are recognized in a document within a group of pixels close to each other. The information returned in a Block depends on the type of operation. In document-text detection (for example DetectDocumentText), you get information about the detected words and lines of text. In text analysis (for example AnalyzeDocument), you can also get information about the fields, tables and selection elements that are detected in the document.

An array of Block objects is returned by both synchronous and asynchronous operations. In synchronous operations, such as DetectDocumentText, the array of Block objects is the entire set of results. In asynchronous operations, such as GetDocumentAnalysis, the array is returned over one or more responses.

For more information, see How Amazon Textract Works (https://docs.aws.amazon.com/textract/latest/dg/how-it-works.html).

func (Block) String

func (s Block) String() string

String returns the string representation

type BlockType

type BlockType string
const (
	BlockTypeKeyValueSet      BlockType = "KEY_VALUE_SET"
	BlockTypePage             BlockType = "PAGE"
	BlockTypeLine             BlockType = "LINE"
	BlockTypeWord             BlockType = "WORD"
	BlockTypeTable            BlockType = "TABLE"
	BlockTypeCell             BlockType = "CELL"
	BlockTypeSelectionElement BlockType = "SELECTION_ELEMENT"
)

Enum values for BlockType

func (BlockType) MarshalValue

func (enum BlockType) MarshalValue() (string, error)

func (BlockType) MarshalValueBuf

func (enum BlockType) MarshalValueBuf(b []byte) ([]byte, error)

type BoundingBox

type BoundingBox struct {

	// The height of the bounding box as a ratio of the overall document page height.
	Height *float64 `type:"float"`

	// The left coordinate of the bounding box as a ratio of overall document page
	// width.
	Left *float64 `type:"float"`

	// The top coordinate of the bounding box as a ratio of overall document page
	// height.
	Top *float64 `type:"float"`

	// The width of the bounding box as a ratio of the overall document page width.
	Width *float64 `type:"float"`
	// contains filtered or unexported fields
}

The bounding box around the recognized text, key, value, table or table cell on a document page. The left (x-coordinate) and top (y-coordinate) are coordinates that represent the top and left sides of the bounding box. Note that the upper-left corner of the image is the origin (0,0).

The top and left values returned are ratios of the overall document page size. For example, if the input image is 700 x 200 pixels, and the top-left coordinate of the bounding box is 350 x 50 pixels, the API returns a left value of 0.5 (350/700) and a top value of 0.25 (50/200).

The width and height values represent the dimensions of the bounding box as a ratio of the overall document page dimension. For example, if the document page size is 700 x 200 pixels, and the bounding box width is 70 pixels, the width returned is 0.1.

func (BoundingBox) String

func (s BoundingBox) String() string

String returns the string representation

type Client added in v0.9.0

type Client struct {
	*aws.Client
}

Client provides the API operation methods for making requests to Amazon Textract. See this package's package overview docs for details on the service.

The client's methods are safe to use concurrently. It is not safe to modify mutate any of the struct's properties though.

func New

func New(config aws.Config) *Client

New creates a new instance of the client from the provided Config.

Example:

// Create a client from just a config.
svc := textract.New(myConfig)

func (*Client) AnalyzeDocumentRequest added in v0.9.0

func (c *Client) AnalyzeDocumentRequest(input *AnalyzeDocumentInput) AnalyzeDocumentRequest

AnalyzeDocumentRequest returns a request value for making API operation for Amazon Textract.

Analyzes an input document for relationships between detected items.

The types of information returned are as follows:

  • Words and lines that are related to nearby lines and words. The related information is returned in two Block objects each of type KEY_VALUE_SET: a KEY Block object and a VALUE Block 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 CELL Block object is returned for each cell in a table.

  • Selectable elements such as checkboxes and radio buttons. A SELECTION_ELEMENT Block object contains information about a selectable element.

  • Lines and words of text. A LINE Block object contains one or more WORD Block objects.

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 (https://docs.aws.amazon.com/textract/latest/dg/how-it-works-analyzing.html).

// Example sending a request using AnalyzeDocumentRequest.
req := client.AnalyzeDocumentRequest(params)
resp, err := req.Send(context.TODO())
if err == nil {
    fmt.Println(resp)
}

Please also see https://docs.aws.amazon.com/goto/WebAPI/textract-2018-06-27/AnalyzeDocument

func (*Client) DetectDocumentTextRequest added in v0.9.0

func (c *Client) DetectDocumentTextRequest(input *DetectDocumentTextInput) DetectDocumentTextRequest

DetectDocumentTextRequest returns a request value for making API operation for Amazon Textract.

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 an image in JPG or PNG format. 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 (https://docs.aws.amazon.com/textract/latest/dg/how-it-works-detecting.html).

// Example sending a request using DetectDocumentTextRequest.
req := client.DetectDocumentTextRequest(params)
resp, err := req.Send(context.TODO())
if err == nil {
    fmt.Println(resp)
}

Please also see https://docs.aws.amazon.com/goto/WebAPI/textract-2018-06-27/DetectDocumentText

func (*Client) GetDocumentAnalysisRequest added in v0.9.0

func (c *Client) GetDocumentAnalysisRequest(input *GetDocumentAnalysisInput) GetDocumentAnalysisRequest

GetDocumentAnalysisRequest returns a request value for making API operation for Amazon Textract.

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:

  • Words and lines that are related to nearby lines and words. The related information is returned in two Block objects each of type KEY_VALUE_SET: a KEY Block object and a VALUE Block 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 CELL Block object is returned for each cell in a table.

  • Selectable elements such as checkboxes and radio buttons. A SELECTION_ELEMENT Block object contains information about a selectable element.

  • Lines and words of text. A LINE Block object contains one or more WORD Block objects.

Use the MaxResults parameter to limit the number of blocks 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 (https://docs.aws.amazon.com/textract/latest/dg/how-it-works-analyzing.html).

// Example sending a request using GetDocumentAnalysisRequest.
req := client.GetDocumentAnalysisRequest(params)
resp, err := req.Send(context.TODO())
if err == nil {
    fmt.Println(resp)
}

Please also see https://docs.aws.amazon.com/goto/WebAPI/textract-2018-06-27/GetDocumentAnalysis

func (*Client) GetDocumentTextDetectionRequest added in v0.9.0

func (c *Client) GetDocumentTextDetectionRequest(input *GetDocumentTextDetectionInput) GetDocumentTextDetectionRequest

GetDocumentTextDetectionRequest returns a request value for making API operation for Amazon Textract.

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 (https://docs.aws.amazon.com/textract/latest/dg/how-it-works-detecting.html).

// Example sending a request using GetDocumentTextDetectionRequest.
req := client.GetDocumentTextDetectionRequest(params)
resp, err := req.Send(context.TODO())
if err == nil {
    fmt.Println(resp)
}

Please also see https://docs.aws.amazon.com/goto/WebAPI/textract-2018-06-27/GetDocumentTextDetection

func (*Client) StartDocumentAnalysisRequest added in v0.9.0

func (c *Client) StartDocumentAnalysisRequest(input *StartDocumentAnalysisInput) StartDocumentAnalysisRequest

StartDocumentAnalysisRequest returns a request value for making API operation for Amazon Textract.

Starts asynchronous analysis of an input document for relationships between detected items such as key and value pairs, tables, and selection elements.

StartDocumentAnalysis can analyze text in documents that are in JPG, PNG, 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 (https://docs.aws.amazon.com/textract/latest/dg/how-it-works-analyzing.html).

// Example sending a request using StartDocumentAnalysisRequest.
req := client.StartDocumentAnalysisRequest(params)
resp, err := req.Send(context.TODO())
if err == nil {
    fmt.Println(resp)
}

Please also see https://docs.aws.amazon.com/goto/WebAPI/textract-2018-06-27/StartDocumentAnalysis

func (*Client) StartDocumentTextDetectionRequest added in v0.9.0

func (c *Client) StartDocumentTextDetectionRequest(input *StartDocumentTextDetectionInput) StartDocumentTextDetectionRequest

StartDocumentTextDetectionRequest returns a request value for making API operation for Amazon Textract.

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 JPG, PNG, 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 (https://docs.aws.amazon.com/textract/latest/dg/how-it-works-detecting.html).

// Example sending a request using StartDocumentTextDetectionRequest.
req := client.StartDocumentTextDetectionRequest(params)
resp, err := req.Send(context.TODO())
if err == nil {
    fmt.Println(resp)
}

Please also see https://docs.aws.amazon.com/goto/WebAPI/textract-2018-06-27/StartDocumentTextDetection

type DetectDocumentTextInput

type DetectDocumentTextInput struct {

	// 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 JPG or PNG format.
	//
	// If you are using an AWS SDK to call Amazon Textract, you might not need to
	// base64-encode image bytes passed using the Bytes field.
	//
	// Document is a required field
	Document *Document `type:"structure" required:"true"`
	// contains filtered or unexported fields
}

func (DetectDocumentTextInput) String

func (s DetectDocumentTextInput) String() string

String returns the string representation

func (*DetectDocumentTextInput) Validate

func (s *DetectDocumentTextInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type DetectDocumentTextOutput

type DetectDocumentTextOutput struct {

	// An array of Block objects containing the text detected in the document.
	Blocks []Block `type:"list"`

	// Metadata about the document. Contains the number of pages that are detected
	// in the document.
	DocumentMetadata *DocumentMetadata `type:"structure"`
	// contains filtered or unexported fields
}

func (DetectDocumentTextOutput) String

func (s DetectDocumentTextOutput) String() string

String returns the string representation

type DetectDocumentTextRequest

type DetectDocumentTextRequest struct {
	*aws.Request
	Input *DetectDocumentTextInput
	Copy  func(*DetectDocumentTextInput) DetectDocumentTextRequest
}

DetectDocumentTextRequest is the request type for the DetectDocumentText API operation.

func (DetectDocumentTextRequest) Send

Send marshals and sends the DetectDocumentText API request.

type DetectDocumentTextResponse added in v0.9.0

type DetectDocumentTextResponse struct {
	*DetectDocumentTextOutput
	// contains filtered or unexported fields
}

DetectDocumentTextResponse is the response type for the DetectDocumentText API operation.

func (*DetectDocumentTextResponse) SDKResponseMetdata added in v0.9.0

func (r *DetectDocumentTextResponse) SDKResponseMetdata() *aws.Response

SDKResponseMetdata returns the response metadata for the DetectDocumentText request.

type Document

type Document struct {

	// A blob of base-64 encoded documents bytes. The maximum size of a document
	// that's provided in a blob of bytes is 5 MB. The document bytes must be in
	// PNG or JPG format.
	//
	// If you are using an AWS SDK to call Amazon Textract, you might not need to
	// base64-encode image bytes passed using the Bytes field.
	//
	// Bytes is automatically base64 encoded/decoded by the SDK.
	Bytes []byte `min:"1" type:"blob"`

	// Identifies an S3 object as the document source. The maximum size of a document
	// stored in an S3 bucket is 5 MB.
	S3Object *S3Object `type:"structure"`
	// contains filtered or unexported fields
}

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 the Bytes property to pass a document loaded from a local file system. Image bytes passed by using the Bytes 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.

func (Document) String

func (s Document) String() string

String returns the string representation

func (*Document) Validate

func (s *Document) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type DocumentLocation

type DocumentLocation struct {

	// The Amazon S3 bucket that contains the input document.
	S3Object *S3Object `type:"structure"`
	// contains filtered or unexported fields
}

The Amazon S3 bucket that contains the document to be processed. It's used by asynchronous operations such as StartDocumentTextDetection.

The input document can be an image file in JPG or PNG format. It can also be a file in PDF format.

func (DocumentLocation) String

func (s DocumentLocation) String() string

String returns the string representation

func (*DocumentLocation) Validate

func (s *DocumentLocation) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type DocumentMetadata

type DocumentMetadata struct {

	// The number of pages detected in the document.
	Pages *int64 `type:"integer"`
	// contains filtered or unexported fields
}

Information about the input document.

func (DocumentMetadata) String

func (s DocumentMetadata) String() string

String returns the string representation

type EntityType

type EntityType string
const (
	EntityTypeKey   EntityType = "KEY"
	EntityTypeValue EntityType = "VALUE"
)

Enum values for EntityType

func (EntityType) MarshalValue

func (enum EntityType) MarshalValue() (string, error)

func (EntityType) MarshalValueBuf

func (enum EntityType) MarshalValueBuf(b []byte) ([]byte, error)

type FeatureType

type FeatureType string
const (
	FeatureTypeTables FeatureType = "TABLES"
	FeatureTypeForms  FeatureType = "FORMS"
)

Enum values for FeatureType

func (FeatureType) MarshalValue

func (enum FeatureType) MarshalValue() (string, error)

func (FeatureType) MarshalValueBuf

func (enum FeatureType) MarshalValueBuf(b []byte) ([]byte, error)

type Geometry

type Geometry struct {

	// An axis-aligned coarse representation of the location of the recognized text
	// on the document page.
	BoundingBox *BoundingBox `type:"structure"`

	// Within the bounding box, a fine-grained polygon around the recognized text.
	Polygon []Point `type:"list"`
	// contains filtered or unexported fields
}

Information about where a recognized text, key, value, table, or table cell is located on a document page.

func (Geometry) String

func (s Geometry) String() string

String returns the string representation

type GetDocumentAnalysisInput

type GetDocumentAnalysisInput struct {

	// A unique identifier for the text-detection job. The JobId is returned from
	// StartDocumentAnalysis.
	//
	// JobId is a required field
	JobId *string `min:"1" type:"string" required:"true"`

	// 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.
	MaxResults *int64 `min:"1" type:"integer"`

	// 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.
	NextToken *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (GetDocumentAnalysisInput) String

func (s GetDocumentAnalysisInput) String() string

String returns the string representation

func (*GetDocumentAnalysisInput) Validate

func (s *GetDocumentAnalysisInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type GetDocumentAnalysisOutput

type GetDocumentAnalysisOutput struct {

	// The results of the text analysis operation.
	Blocks []Block `type:"list"`

	// Information about a document that Amazon Textract processed. DocumentMetadata
	// is returned in every page of paginated responses from an Amazon Textract
	// video operation.
	DocumentMetadata *DocumentMetadata `type:"structure"`

	// The current status of the text detection job.
	JobStatus JobStatus `type:"string" enum:"true"`

	// 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.
	NextToken *string `min:"1" type:"string"`

	// The current status of an asynchronous document analysis operation.
	StatusMessage *string `type:"string"`

	// A list of warnings that occurred during the document analysis operation.
	Warnings []Warning `type:"list"`
	// contains filtered or unexported fields
}

func (GetDocumentAnalysisOutput) String

func (s GetDocumentAnalysisOutput) String() string

String returns the string representation

type GetDocumentAnalysisRequest

type GetDocumentAnalysisRequest struct {
	*aws.Request
	Input *GetDocumentAnalysisInput
	Copy  func(*GetDocumentAnalysisInput) GetDocumentAnalysisRequest
}

GetDocumentAnalysisRequest is the request type for the GetDocumentAnalysis API operation.

func (GetDocumentAnalysisRequest) Send

Send marshals and sends the GetDocumentAnalysis API request.

type GetDocumentAnalysisResponse added in v0.9.0

type GetDocumentAnalysisResponse struct {
	*GetDocumentAnalysisOutput
	// contains filtered or unexported fields
}

GetDocumentAnalysisResponse is the response type for the GetDocumentAnalysis API operation.

func (*GetDocumentAnalysisResponse) SDKResponseMetdata added in v0.9.0

func (r *GetDocumentAnalysisResponse) SDKResponseMetdata() *aws.Response

SDKResponseMetdata returns the response metadata for the GetDocumentAnalysis request.

type GetDocumentTextDetectionInput

type GetDocumentTextDetectionInput struct {

	// A unique identifier for the text detection job. The JobId is returned from
	// StartDocumentTextDetection.
	//
	// JobId is a required field
	JobId *string `min:"1" type:"string" required:"true"`

	// 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.
	MaxResults *int64 `min:"1" type:"integer"`

	// 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.
	NextToken *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (GetDocumentTextDetectionInput) String

String returns the string representation

func (*GetDocumentTextDetectionInput) Validate

func (s *GetDocumentTextDetectionInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type GetDocumentTextDetectionOutput

type GetDocumentTextDetectionOutput struct {

	// The results of the text-detection operation.
	Blocks []Block `type:"list"`

	// Information about a document that Amazon Textract processed. DocumentMetadata
	// is returned in every page of paginated responses from an Amazon Textract
	// video operation.
	DocumentMetadata *DocumentMetadata `type:"structure"`

	// The current status of the text detection job.
	JobStatus JobStatus `type:"string" enum:"true"`

	// 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.
	NextToken *string `min:"1" type:"string"`

	// The current status of an asynchronous document text-detection operation.
	StatusMessage *string `type:"string"`

	// A list of warnings that occurred during the document text-detection operation.
	Warnings []Warning `type:"list"`
	// contains filtered or unexported fields
}

func (GetDocumentTextDetectionOutput) String

String returns the string representation

type GetDocumentTextDetectionRequest

type GetDocumentTextDetectionRequest struct {
	*aws.Request
	Input *GetDocumentTextDetectionInput
	Copy  func(*GetDocumentTextDetectionInput) GetDocumentTextDetectionRequest
}

GetDocumentTextDetectionRequest is the request type for the GetDocumentTextDetection API operation.

func (GetDocumentTextDetectionRequest) Send

Send marshals and sends the GetDocumentTextDetection API request.

type GetDocumentTextDetectionResponse added in v0.9.0

type GetDocumentTextDetectionResponse struct {
	*GetDocumentTextDetectionOutput
	// contains filtered or unexported fields
}

GetDocumentTextDetectionResponse is the response type for the GetDocumentTextDetection API operation.

func (*GetDocumentTextDetectionResponse) SDKResponseMetdata added in v0.9.0

func (r *GetDocumentTextDetectionResponse) SDKResponseMetdata() *aws.Response

SDKResponseMetdata returns the response metadata for the GetDocumentTextDetection request.

type JobStatus

type JobStatus string
const (
	JobStatusInProgress     JobStatus = "IN_PROGRESS"
	JobStatusSucceeded      JobStatus = "SUCCEEDED"
	JobStatusFailed         JobStatus = "FAILED"
	JobStatusPartialSuccess JobStatus = "PARTIAL_SUCCESS"
)

Enum values for JobStatus

func (JobStatus) MarshalValue

func (enum JobStatus) MarshalValue() (string, error)

func (JobStatus) MarshalValueBuf

func (enum JobStatus) MarshalValueBuf(b []byte) ([]byte, error)

type NotificationChannel

type NotificationChannel struct {

	// The Amazon Resource Name (ARN) of an IAM role that gives Amazon Textract
	// publishing permissions to the Amazon SNS topic.
	//
	// RoleArn is a required field
	RoleArn *string `min:"20" type:"string" required:"true"`

	// The Amazon SNS topic that Amazon Textract posts the completion status to.
	//
	// SNSTopicArn is a required field
	SNSTopicArn *string `min:"20" type:"string" required:"true"`
	// contains filtered or unexported fields
}

The Amazon Simple Notification Service (Amazon SNS) topic to which Amazon Textract publishes the completion status of an asynchronous document operation, such as StartDocumentTextDetection.

func (NotificationChannel) String

func (s NotificationChannel) String() string

String returns the string representation

func (*NotificationChannel) Validate

func (s *NotificationChannel) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type Point

type Point struct {

	// The value of the X coordinate for a point on a Polygon.
	X *float64 `type:"float"`

	// The value of the Y coordinate for a point on a Polygon.
	Y *float64 `type:"float"`
	// contains filtered or unexported fields
}

The X and Y coordinates of a point on a document page. The X and Y values returned are ratios of the overall document page size. For example, if the input document is 700 x 200 and the operation returns X=0.5 and Y=0.25, then the point is at the (350,50) pixel coordinate on the document page.

An array of Point objects, Polygon, is returned by DetectDocumentText. Polygon represents a fine-grained polygon around detected text. For more information, see Geometry in the Amazon Textract Developer Guide.

func (Point) String

func (s Point) String() string

String returns the string representation

type Relationship

type Relationship struct {

	// An array of IDs for related blocks. You can get the type of the relationship
	// from the Type element.
	Ids []string `type:"list"`

	// The type of relationship that the blocks in the IDs array have with the current
	// block. The relationship can be VALUE or CHILD.
	Type RelationshipType `type:"string" enum:"true"`
	// contains filtered or unexported fields
}

Information about how blocks are related to each other. A Block object contains 0 or more Relation objects in a list, Relationships. For more information, see Block.

The Type element provides the type of the relationship for all blocks in the IDs array.

func (Relationship) String

func (s Relationship) String() string

String returns the string representation

type RelationshipType

type RelationshipType string
const (
	RelationshipTypeValue RelationshipType = "VALUE"
	RelationshipTypeChild RelationshipType = "CHILD"
)

Enum values for RelationshipType

func (RelationshipType) MarshalValue

func (enum RelationshipType) MarshalValue() (string, error)

func (RelationshipType) MarshalValueBuf

func (enum RelationshipType) MarshalValueBuf(b []byte) ([]byte, error)

type S3Object

type S3Object struct {

	// The name of the S3 bucket.
	Bucket *string `min:"3" type:"string"`

	// The file name of the input document. It must be an image file (.JPG or .PNG
	// format). Asynchronous operations also support PDF files.
	Name *string `min:"1" type:"string"`

	// If the bucket has versioning enabled, you can specify the object version.
	Version *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

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.

func (S3Object) String

func (s S3Object) String() string

String returns the string representation

func (*S3Object) Validate

func (s *S3Object) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type SelectionStatus

type SelectionStatus string
const (
	SelectionStatusSelected    SelectionStatus = "SELECTED"
	SelectionStatusNotSelected SelectionStatus = "NOT_SELECTED"
)

Enum values for SelectionStatus

func (SelectionStatus) MarshalValue

func (enum SelectionStatus) MarshalValue() (string, error)

func (SelectionStatus) MarshalValueBuf

func (enum SelectionStatus) MarshalValueBuf(b []byte) ([]byte, error)

type StartDocumentAnalysisInput

type StartDocumentAnalysisInput struct {

	// The idempotent token that you use to identify the start request. If you use
	// the same token with multiple StartDocumentAnalysis requests, the same JobId
	// is returned. Use ClientRequestToken to prevent the same job from being accidentally
	// started more than once.
	ClientRequestToken *string `min:"1" type:"string"`

	// The location of the document to be processed.
	//
	// DocumentLocation is a required field
	DocumentLocation *DocumentLocation `type:"structure" required:"true"`

	// 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 fields and the associated text. To perform both
	// types of analysis, add TABLES and FORMS to FeatureTypes. All selectable elements
	// (SELECTION_ELEMENT) that are detected are returned, whatever the value of
	// FeatureTypes.
	//
	// FeatureTypes is a required field
	FeatureTypes []FeatureType `type:"list" required:"true"`

	// An identifier you specify that's included in the completion notification
	// that's published to the Amazon SNS topic. For example, you can use JobTag
	// to identify the type of document, such as a tax form or a receipt, that the
	// completion notification corresponds to.
	JobTag *string `min:"1" type:"string"`

	// The Amazon SNS topic ARN that you want Amazon Textract to publish the completion
	// status of the operation to.
	NotificationChannel *NotificationChannel `type:"structure"`
	// contains filtered or unexported fields
}

func (StartDocumentAnalysisInput) String

String returns the string representation

func (*StartDocumentAnalysisInput) Validate

func (s *StartDocumentAnalysisInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type StartDocumentAnalysisOutput

type StartDocumentAnalysisOutput struct {

	// The identifier for the document text detection job. Use JobId to identify
	// the job in a subsequent call to GetDocumentAnalysis.
	JobId *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (StartDocumentAnalysisOutput) String

String returns the string representation

type StartDocumentAnalysisRequest

type StartDocumentAnalysisRequest struct {
	*aws.Request
	Input *StartDocumentAnalysisInput
	Copy  func(*StartDocumentAnalysisInput) StartDocumentAnalysisRequest
}

StartDocumentAnalysisRequest is the request type for the StartDocumentAnalysis API operation.

func (StartDocumentAnalysisRequest) Send

Send marshals and sends the StartDocumentAnalysis API request.

type StartDocumentAnalysisResponse added in v0.9.0

type StartDocumentAnalysisResponse struct {
	*StartDocumentAnalysisOutput
	// contains filtered or unexported fields
}

StartDocumentAnalysisResponse is the response type for the StartDocumentAnalysis API operation.

func (*StartDocumentAnalysisResponse) SDKResponseMetdata added in v0.9.0

func (r *StartDocumentAnalysisResponse) SDKResponseMetdata() *aws.Response

SDKResponseMetdata returns the response metadata for the StartDocumentAnalysis request.

type StartDocumentTextDetectionInput

type StartDocumentTextDetectionInput struct {

	// The idempotent token that's used to identify the start request. If you use
	// the same token with multiple StartDocumentTextDetection requests, the same
	// JobId is returned. Use ClientRequestToken to prevent the same job from being
	// accidentally started more than once.
	ClientRequestToken *string `min:"1" type:"string"`

	// The location of the document to be processed.
	//
	// DocumentLocation is a required field
	DocumentLocation *DocumentLocation `type:"structure" required:"true"`

	// An identifier you specify that's included in the completion notification
	// that's published to the Amazon SNS topic. For example, you can use JobTag
	// to identify the type of document, such as a tax form or a receipt, that the
	// completion notification corresponds to.
	JobTag *string `min:"1" type:"string"`

	// The Amazon SNS topic ARN that you want Amazon Textract to publish the completion
	// status of the operation to.
	NotificationChannel *NotificationChannel `type:"structure"`
	// contains filtered or unexported fields
}

func (StartDocumentTextDetectionInput) String

String returns the string representation

func (*StartDocumentTextDetectionInput) Validate

func (s *StartDocumentTextDetectionInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type StartDocumentTextDetectionOutput

type StartDocumentTextDetectionOutput struct {

	// The identifier for the document text-detection job. Use JobId to identify
	// the job in a subsequent call to GetDocumentTextDetection.
	JobId *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

func (StartDocumentTextDetectionOutput) String

String returns the string representation

type StartDocumentTextDetectionRequest

type StartDocumentTextDetectionRequest struct {
	*aws.Request
	Input *StartDocumentTextDetectionInput
	Copy  func(*StartDocumentTextDetectionInput) StartDocumentTextDetectionRequest
}

StartDocumentTextDetectionRequest is the request type for the StartDocumentTextDetection API operation.

func (StartDocumentTextDetectionRequest) Send

Send marshals and sends the StartDocumentTextDetection API request.

type StartDocumentTextDetectionResponse added in v0.9.0

type StartDocumentTextDetectionResponse struct {
	*StartDocumentTextDetectionOutput
	// contains filtered or unexported fields
}

StartDocumentTextDetectionResponse is the response type for the StartDocumentTextDetection API operation.

func (*StartDocumentTextDetectionResponse) SDKResponseMetdata added in v0.9.0

func (r *StartDocumentTextDetectionResponse) SDKResponseMetdata() *aws.Response

SDKResponseMetdata returns the response metadata for the StartDocumentTextDetection request.

type Warning

type Warning struct {

	// The error code for the warning.
	ErrorCode *string `type:"string"`

	// A list of the pages that the warning applies to.
	Pages []int64 `type:"list"`
	// contains filtered or unexported fields
}

A warning about an issue that occurred during asynchronous text analysis (StartDocumentAnalysis) or asynchronous document-text detection (StartDocumentTextDetection).

func (Warning) String

func (s Warning) String() string

String returns the string representation

Directories

Path Synopsis
Package textractiface provides an interface to enable mocking the Amazon Textract service client for testing your code.
Package textractiface provides an interface to enable mocking the Amazon Textract service client for testing your code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL