in textract-pipeline/lambda/syncprocessor/lambda_function.py [0:0]
def callTextract(bucketName, objectName, detectText, detectForms, detectTables):
textract = AwsHelper().getClient('textract')
if(not detectForms and not detectTables):
response = textract.detect_document_text(
Document={
'S3Object': {
'Bucket': bucketName,
'Name': objectName
}
}
)
else:
features = []
if(detectTables):
features.append("TABLES")
if(detectForms):
features.append("FORMS")
response = textract.analyze_document(
Document={
'S3Object': {
'Bucket': bucketName,
'Name': objectName
}
},
FeatureTypes=features
)
return response