gpt4 book ai didi

python - 如何使用xml :writeFormatting of ABBYY OCR SDK in python?

转载 作者:太空宇宙 更新时间:2023-11-03 20:13:19 33 4
gpt4 key购买 nike

我正在使用 ABBYY OCR SDK 将文本图像转换为 Python 中的 xml。我的目标是保留文本格式,因此我一直在尝试使用 xml:writeFormatting 参数,如下所示:

ocr_engine = CloudOCR(application_id='', password='')
jpg = open('pic16.JPG', 'rb')
file = {jpg.name: jpg}
result = ocr_engine.process_and_download(file,

exportFormat='xml&xml:writeFormatting=true', language='English')
result

for format, content in result.items():
with open('converted.xml', 'wb') as output_file:
output_file.write(content.read())
output_file.close()

并弹出以下错误:

HTTPError: 450 Client Error: Unknown format xmlwriteFormatting=true for url: http://cloud-eu.ocrsdk.com/processImage?exportFormat=xmlwriteFormatting%3Dtrue&language=English

最佳答案

根据示例,我猜这不是 ABBYY OCR SDK。这是 ABBYY Cloud SDK(具有相似用途的完全不同的产品)。 ABBYY SDK 使用您的计算机 CPU 能力来 OCR 文本,Cloud OCR SDK 使用 ABBYY 在线服务来执行相同的操作。

xml:writeFormatting 应该是“yes”或“no”,而不是“true”或“false”。

关于python - 如何使用xml :writeFormatting of ABBYY OCR SDK in python?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58601705/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com