Class: AWSCDK::Comprehend::CfnDocumentClassifier::DocumentReaderConfigProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
comprehend/cfn_document_classifier.rb

Overview

Provides configuration parameters to override the default actions for extracting text from PDF documents and image files.

By default, Amazon Comprehend performs the following actions to extract text from files, based on the input file type:

  • Word files - Amazon Comprehend parser extracts the text.
  • Digital PDF files - Amazon Comprehend parser extracts the text.
  • Image files and scanned PDF files - Amazon Comprehend uses the Amazon Textract DetectDocumentText API to extract the text.

DocumentReaderConfig does not apply to plain text files or Word files.

For image files and PDF documents, you can override these default actions using the fields listed below. For more information, see Setting text extraction options in the Comprehend Developer Guide.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document_read_action:, document_read_mode: nil, feature_types: nil) ⇒ DocumentReaderConfigProperty

Returns a new instance of DocumentReaderConfigProperty.

Parameters:

  • document_read_action (String)

    This field defines the Amazon Textract API operation that Amazon Comprehend uses to extract text from PDF files and image files.

  • document_read_mode (String, nil) (defaults to: nil)

    Determines the text extraction actions for PDF files. Enter one of the following values:.

  • feature_types (Array<String>, nil) (defaults to: nil)

    Specifies the type of Amazon Textract features to apply.



975
976
977
978
979
980
981
982
# File 'comprehend/cfn_document_classifier.rb', line 975

def initialize(document_read_action:, document_read_mode: nil, feature_types: nil)
  @document_read_action = document_read_action
  Jsii::Type.check_type(@document_read_action, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "documentReadAction")
  @document_read_mode = document_read_mode
  Jsii::Type.check_type(@document_read_mode, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "documentReadMode") unless @document_read_mode.nil?
  @feature_types = feature_types
  Jsii::Type.check_type(@feature_types, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "featureTypes") unless @feature_types.nil?
end

Instance Attribute Details

#document_read_actionString (readonly)

This field defines the Amazon Textract API operation that Amazon Comprehend uses to extract text from PDF files and image files.

Enter one of the following values:

  • TEXTRACT_DETECT_DOCUMENT_TEXT - The Amazon Comprehend service uses the DetectDocumentText API operation.
  • TEXTRACT_ANALYZE_DOCUMENT - The Amazon Comprehend service uses the AnalyzeDocument API operation.


993
994
995
# File 'comprehend/cfn_document_classifier.rb', line 993

def document_read_action
  @document_read_action
end

#document_read_modeString? (readonly)

Determines the text extraction actions for PDF files. Enter one of the following values:.

  • SERVICE_DEFAULT - use the Amazon Comprehend service defaults for PDF files.
  • FORCE_DOCUMENT_READ_ACTION - Amazon Comprehend uses the Textract API specified by DocumentReadAction for all PDF files, including digital PDF files.


1001
1002
1003
# File 'comprehend/cfn_document_classifier.rb', line 1001

def document_read_mode
  @document_read_mode
end

#feature_typesArray<String>? (readonly)

Specifies the type of Amazon Textract features to apply.

If you chose TEXTRACT_ANALYZE_DOCUMENT as the read action, you must specify one or both of the following values:

  • TABLES - Returns additional information about any tables that are detected in the input document.
  • FORMS - Returns additional information about any forms that are detected in the input document.


1011
1012
1013
# File 'comprehend/cfn_document_classifier.rb', line 1011

def feature_types
  @feature_types
end

Class Method Details

.jsii_propertiesObject



1013
1014
1015
1016
1017
1018
1019
# File 'comprehend/cfn_document_classifier.rb', line 1013

def self.jsii_properties
  {
    :document_read_action => "documentReadAction",
    :document_read_mode => "documentReadMode",
    :feature_types => "featureTypes",
  }
end

Instance Method Details

#to_jsiiObject



1021
1022
1023
1024
1025
1026
1027
1028
1029
# File 'comprehend/cfn_document_classifier.rb', line 1021

def to_jsii
  result = {}
  result.merge!({
    "documentReadAction" => @document_read_action,
    "documentReadMode" => @document_read_mode,
    "featureTypes" => @feature_types,
  })
  result.compact
end