你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
OcrResult 类
OcrResult。
- 继承
-
OcrResult
构造函数
OcrResult(*, language: str = None, text_angle: float = None, orientation: str = None, regions=None, model_version: str = None, **kwargs)
参数
- text_angle
- float
检测到的文本相对于最接近的水平或垂直方向的角度(以弧度为单位)。 按此角度顺时针旋转输入图像后,识别的文本行将变为水平或垂直。 与方向属性结合使用,它可用于在原始图像上正确覆盖识别结果,方法是将原始图像或识别结果旋转到原始图像中心周围的适当角度。 如果无法自信地检测到角度,则此属性不存在。 如果图像包含不同角度的文本,则只会正确识别部分文本。
- orientation
- str
图像中识别的文本的方向(如果需要)。 值 (向上、向下、向左或向右) 是指图像根据检测到的文本角度围绕其中心旋转后,识别的文本顶部正对的方向 (看到 textAngle 属性) 。 如果未请求检测方向,或者未检测到任何文本,则值为“NotDetected”。
- model_version
- str
方法
as_dict |
返回可以使用 json.dump 的 JSONify 的 dict。 高级用法可以选择使用回调作为参数: Key 是 Python 中使用的属性名称。 Attr_desc是元数据的一个听写。 当前包含具有 msrest 类型的“type”和包含 RestAPI 编码键的“key”。 值是此对象中的当前值。 返回的字符串将用于序列化密钥。 如果返回类型是列表,则这被视为分层结果听写。 请参阅此文件中的三个示例:
如果需要 XML 序列化,可以传递 kwargs is_xml=True。 |
deserialize |
使用 RestAPI 语法分析 str 并返回模型。 |
enable_additional_properties_sending | |
from_dict |
使用给定的键提取程序分析 dict 返回一个模型。 默认情况下,请考虑密钥提取程序 (rest_key_case_insensitive_extractor、attribute_key_case_insensitive_extractor和last_rest_key_case_insensitive_extractor) |
is_xml_model | |
serialize |
返回将从此模型发送到 azure 的 JSON。 这是as_dict (full_restapi_key_transformer的别名 ,keep_readonly=False) 。 如果需要 XML 序列化,可以传递 kwargs is_xml=True。 |
validate |
以递归方式验证此模型,并返回 ValidationError 列表。 |
as_dict
返回可以使用 json.dump 的 JSONify 的 dict。
高级用法可以选择使用回调作为参数:
Key 是 Python 中使用的属性名称。 Attr_desc是元数据的一个听写。 当前包含具有 msrest 类型的“type”和包含 RestAPI 编码键的“key”。 值是此对象中的当前值。
返回的字符串将用于序列化密钥。 如果返回类型是列表,则这被视为分层结果听写。
请参阅此文件中的三个示例:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
如果需要 XML 序列化,可以传递 kwargs is_xml=True。
as_dict(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)
参数
- key_transformer
- <xref:function>
密钥转换器函数。
- keep_readonly
返回
与 dict JSON 兼容的对象
返回类型
deserialize
使用 RestAPI 语法分析 str 并返回模型。
deserialize(data, content_type=None)
参数
返回
此模型的实例
例外
enable_additional_properties_sending
enable_additional_properties_sending()
from_dict
使用给定的键提取程序分析 dict 返回一个模型。
默认情况下,请考虑密钥提取程序 (rest_key_case_insensitive_extractor、attribute_key_case_insensitive_extractor和last_rest_key_case_insensitive_extractor)
from_dict(data, key_extractors=None, content_type=None)
参数
- key_extractors
返回
此模型的实例
例外
is_xml_model
is_xml_model()
serialize
返回将从此模型发送到 azure 的 JSON。
这是as_dict (full_restapi_key_transformer的别名 ,keep_readonly=False) 。
如果需要 XML 序列化,可以传递 kwargs is_xml=True。
serialize(keep_readonly=False, **kwargs)
参数
返回
与 dict JSON 兼容的对象