AWS
AWS
The AWS module is responsible for actions that integrate the Amazon Web Service tool.
Methods
Textract
Method responsible for recognizing and getting the characters in an image passed by the user using the Textract tool of Amazon Web Service. For example: if the image passed by the user contains the word "Roberty", this action tries to recognize it character by character and return them.
js
const textract = await API.AWS.textract["v1_0_0"]({
useCustomCredentials: true,
credentials: {
accessKeyId: `asd`,
secretAccessKey: `dsa`,
},
featureType: ["FORMS", "TABLES", "QUERIES"],
queries: [`Qual a data de vencimento?`],
bucket: `qwe`,
filePath: `C:\\Roberty`,
timeout: 120,
});
Required parameters
useCustomCredentials: Boolean - expects a boolean value representing whether a custom credential will be used or not.credentials: Object - if the valuetrueis passed inuseCustomCredentials, this parameter becomes required. It expects an object containing the value ofaccessKeyID: String andsecretAccessKey: String.featureType: String[] - expects an array of strings with at least one of the following values:FORMS,TABLES,QUERIES.queries: String[] - if the valueQUERIESis passed infeatureType, this parameter becomes required. It expects an array of strings with a question that must be answered by the document analysis.bucket: String - expects the name of the Bucket created in S3 to store the files temporarily.filePath: String - expects a string indicating the path where the file is saved.timeout: Number - expects a value in seconds indicating the maximum waiting time for the element to be recognized. If it is not passed, the default value is 120 seconds.
Optional parameters
This method has no optional parameters.
Return
The constant or variable created, such as the textract of the example shown earlier, receives a value of the List type that gives access to the following properties:
textract.words: Array - Returns every word found by the analysis.textract.lines: Array - Returns every line of words found by the analysis.textract.forms: Array - Returns the information obtained during the analysis as information forms.textract.tables: Array - Returns the tables found during the analysis.textract.queries: Array - Returns the questions and answers asked and obtained by the user and the analysis.