小编gmw*_*934的帖子

AWS Textract - UnsupportedDocumentException - PDF

我正在使用 boto3(适用于 python 的 aws sdk)来分析文档(pdf)以获取表单键:值对。

import boto3

def process_text_analysis(bucket, document):
    # Get the document from S3
    s3_connection = boto3.resource('s3')
    s3_object = s3_connection.Object(bucket, document)
    s3_response = s3_object.get()
    # Analyze the document
    client = boto3.client('textract')
    response = client.analyze_document(Document={'S3Object': {'Bucket': bucket, 'Name': document}},
                                       FeatureTypes=["FORMS"])


process_text_analysis('francismorgan-01', '709 Privado M SURESTE.pdf')
Run Code Online (Sandbox Code Playgroud)

我已使用分析文档遵循 ​​AWS 文档,当我运行我的函数时,我收到错误。

botocore.errorfactory.UnsupportedDocumentException: An error occurred (UnsupportedDocumentException) when calling the AnalyzeDocument operation: Request has unsupported document format
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?

python amazon-web-services boto3 amazon-textract

6
推荐指数
1
解决办法
7066
查看次数

Informix - 删除临时表(如果存在)

我试图在运行查询时删除临时表。我找不到答案并且已经搜索了文档。

基本上,我想做的是检查表是否存在;如果确实存在,请将其删除并继续选择,以便将结果插入到临时表中。如果它不存在,那么,只需创建 TEMP 表,以便可以插入结果。

我正在使用 Informix 11.70

sql informix

4
推荐指数
1
解决办法
7452
查看次数

与 Typescript 相交的类型

我有两种自定义类型

type TypeA = string | number;
type TypeB = string | boolean;
Run Code Online (Sandbox Code Playgroud)

我使用上述创建了一个交叉类型

type Combined = TypeA & TypeB;
Run Code Online (Sandbox Code Playgroud)

自然,该Combined类型只会是 type string,因为它是唯一与TypeA和相交的类型TypeB

但是,如果我改变工会TypeB,并添加一个日期类型,我得到一个意外的行为,例如:

type TypeA = string | number;
type TypeB = string | boolean | Date;
Run Code Online (Sandbox Code Playgroud)

创建新的交叉点类型

type Combined = TypeA & TypeB;
Run Code Online (Sandbox Code Playgroud)

如果我检查类型的签名,它看起来像这样

type Combined = string | (string & Date) | (number & Date)
Run Code Online (Sandbox Code Playgroud)

我的问题是为什么会这样?这是预期的吗?我认为它是string类型,因为它是唯一相交的类型 …

types intersection typescript

3
推荐指数
2
解决办法
1330
查看次数