有奖捉虫:云通信与企业服务文档专题,速来> HOT

1. 接口描述

接口请求域名: ecc.tencentcloudapi.com 。

https://ecc.tencentcloudapi.com/?Action=EHOCR
图像识别批改接口

默认接口请求频率限制:1000次/秒。

推荐使用 API Explorer
点击调试
API Explorer 提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力。您可查看每次调用的请求内容和返回结果以及自动生成 SDK 调用示例。

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数

参数名称 必选 类型 描述
Action String 公共参数,本接口取值:EHOCR。
Version String 公共参数,本接口取值:2018-12-13。
Region String 公共参数,本接口不需要传递此参数。
Image String 图片所在的url或base64编码后的图像数据,依据InputType而定
InputType Integer 输出图片类型,0 表示 Image 字段是图片所在的 url,1 表示 Image 字段是 base64 编码后的图像数据
示例值:0
EccAppid String 业务应用ID,与账号应用APPID无关,是用来方便客户管理服务的参数(暂时无需传入)。
示例值:default
SessionId String 图像识别唯一标识,一次识别一个 SessionId,使用识别功能时 SessionId 可用于使用文本批改接口,此时按图像批改价格收费;如使用文本批改接口时没有传入 SessionId,则需要收取文本批改的费用
ServerType Integer 服务类型,0:“图像识别”,只返回识别结果,1:“图像批改”,同时返回识别结果与批改结果。默认为 0
示例值:1
Title String 作文题目,可选参数
Grade String 年级标准, 默认以 cet4 为标准,取值与意义如下:elementary 小学,grade7 grade8 grade9分别对应初一,初二,初三。 grade10 grade11 grade12 分别对应高一,高二,高三,以及 cet4 和 cet6 分别表示 英语4级和6级。
示例值:elementary
Requirement String 作文提纲,可选参数,作文的写作要求。
ModelTitle String 范文标题,可选参数,本接口可以依据提供的范文对作文进行评分。
ModelContent String 范文内容,可选参数,同上,范文的正文部分。
IsAsync Integer 异步模式标识,0:同步模式,1:异步模式。默认为同步模式
示例值:0

3. 输出参数

参数名称 类型 描述
ResultData CompositionContext 接口返回数据
RequestId String 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。

4. 示例

示例1 图像识别批改-识别

ServerType = 0,使用识别功能,只返回识别文本(内容仅为参考,非实际返回结果)

输入示例

https://ecc.tencentcloudapi.com/?Action=EHOCR
&InputType=1
&Image=ccc
&ServerType=0
&<公共请求参数>

输出示例

{
    "Response": {
        "ResultData": {
            "Content": "this is compostion content",
            "CorrectData": null,
            "TaskId": null
        },
        "RequestId": "ae5d82c1-47a1-43c0-b8a2-4d3c35a21488"
    }
}

示例2 图像识别批改-批改

ServerType = 1,使用批改功能,返回识别文本与批改结果(内容仅为参考,非实际批改结果)

输入示例

https://ecc.tencentcloudapi.com/?Action=EHOCR
&InputType=1
&Image=ccc
&ServerType=1
&<公共请求参数>

输出示例

{
    "Response": {
        "ResultData": {
            "Content": "this is compostion content",
            "CorrectData": {
                "Score": 72.39,
                "ScoreCat": {
                    "Words": {
                        "Name": "词汇",
                        "Score": 76.08,
                        "Percentage": 42
                    },
                    "Sentences": {
                        "Name": "句子",
                        "Score": 61.16,
                        "Percentage": 28
                    },
                    "Structure": {
                        "Name": "篇章结构",
                        "Score": 80.37,
                        "Percentage": 23
                    },
                    "Content": {
                        "Name": "内容",
                        "Score": 69,
                        "Percentage": 7
                    },
                    "Score": 0,
                    "Percentage": 0
                },
                "Comment": "作者词汇基础扎实;可适当增加复合句和从句的使用;文中衔接词丰富。请多加练习,更上一层楼。",
                "SentenceComments": [
                    {
                        "Sentence": {
                            "Sentence": "Teenagers likeating fast 1888861 food.",
                            "ParaID": 1,
                            "SentenceID": 7
                        },
                        "Suggestions": [
                            {
                                "Type": "Error",
                                "ErrorType": "拼写错误",
                                "Origin": "likeating",
                                "Replace": "elevating",
                                "Message": "likeating 可能是拼写错误,请注意拼写检查,这里应将 likeating 替换为 elevating",
                                "ErrorPosition": [
                                    8,
                                    8
                                ],
                                "ErrorCoordinates": [
                                    {
                                        "Coordinate": [
                                            424,
                                            360,
                                            459,
                                            359,
                                            459,
                                            386,
                                            424,
                                            387
                                        ]
                                    }
                                ]
                            },
                            {
                                "Type": "Error",
                                "ErrorType": "易混淆词汇建议",
                                "Origin": "1888861",
                                "Replace": "1886861",
                                "Message": "注意1888861 与 1886861 的区别,推荐将 1888861 替换为 1886861",
                                "ErrorPosition": [
                                    8,
                                    8
                                ],
                                "ErrorCoordinates": [
                                    {
                                        "Coordinate": [
                                            424,
                                            360,
                                            459,
                                            359,
                                            459,
                                            386,
                                            424,
                                            387
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            },
            "TaskId": null
        },
        "RequestId": "ae5d82c1-47a1-43c0-b8a2-4d3c35a21488"
    }
}

示例3 图像识别批改-异步

IsAsync= 1,使用异步处理(内容仅为参考,非实际返回结果)

输入示例

https://ecc.tencentcloudapi.com/?Action=EHOCR
&InputType=1
&Image=ccc
&IsAsync=1
&<公共请求参数>

输出示例

{
    "Response": {
        "ResultData": {
            "Content": "",
            "CorrectData": null,
            "TaskId": "10000010"
        },
        "RequestId": "ae5d82c1-47a1-43c0-b8a2-4d3c35a21488"
    }
}

5. 开发者资源

腾讯云 API 平台

腾讯云 API 平台 是综合 API 文档、错误码、API Explorer 及 SDK 等资源的统一查询平台,方便您从同一入口查询及使用腾讯云提供的所有 API 服务。

API Inspector

用户可通过 API Inspector 查看控制台每一步操作关联的 API 调用情况,并自动生成各语言版本的 API 代码,也可前往 API Explorer 进行在线调试。

SDK

云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。

命令行工具

6. 错误码

以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码

错误码 描述
InternalError 内部错误。
InternalError.CorrectError 批改错误。
InternalError.DatabaseServerInternalError 服务内部错误。
InternalError.OcrError 识别错误。
InternalError.OcrServerInternError 服务器内部错误,初始化失败。
InternalError.OtherError 其它错误。
InternalError.OverLoadError 服务器过载,请联系相关客服。
InternalError.RecognizeError 图片识别错误。
InternalError.ServerConnectDownloadError 无法连接图像下载服务器。
InternalError.SplitError 图片切割错误。
InvalidParameter.EmptyParameterError 参数为空。
InvalidParameter.InputError 传入的参数有误。
InvalidParameterValue.AppidInvalidError Appid无效。
InvalidParameterValue.DecodeImageError 图片解码失败,请核实输入信息。
InvalidParameterValue.DownloadImageFailError url图片下载失败。
InvalidParameterValue.EmptyImageError 图片数据为空。
InvalidParameterValue.ImageDownloadFailError 图片下载失败。
InvalidParameterValue.ImageSizeExceedError 图片超出下载限制。
InvalidParameterValue.ImageTooBigError 图片尺寸太大。
InvalidParameterValue.InputTypeValueError 输入错误,请核实InputType参数。
InvalidParameterValue.SessionError SessionId无效。
InvalidParameterValue.UrlFromatIvadlidError 图像请求URL的格式错误。
LimitExceeded.FreqLimitForbiddenAccessError 频率限制。
ResourceNotFound.CannotFindUser 无法找到用户,请确认已在控制台开通服务并使用了正确的 ECCAPPID。
ResourceNotFound.ServerNameNotExistInLicenseError 无效的服务名称。
ResourceUnavailable.AuthorizeError 服务未开通或已欠费。
UnauthorizedOperation.LicenseInvalidForbiddenAccessError license无效。
UnauthorizedOperation.ServerNameUnauthorizedInError license中未授权该服务。