Appearance
Rewriter Open API V2
介绍
获取文本内容检测结果与评估报告
- 暂不提供用户主动申请应用功能
- 如需开通文本评估开放api应用,请联系管理员
- 管理员开通应用后会通知 appId apiKey 等信息
- 如需冻结/打开应用,重置 apiKey,请联系管理员并提供app信息
- 通过 appId 与 apiKey 联合加密 sign = sha1(appId + "&" + appKey)
- 调用方法如下具体实现可见代码
- 示例代码下载:https://gitee.com/tmxmall/rewriter-openapi
Java示例
/**
* 加签
*/
String sign = sha1(appId + "&" + appKey);
String text = "Today I shed my old skin which hath, too long, suffered the bruises of failure and the wounds of mediority.Today I am born anew and my birthplace is a vineyard where there is fruit for all.Today I will pluck grapes of wisdom from the tallest and fullest vines in the vineyard,for these were planted by the wisest of my profession who have come before me,generation upon generation.Today I will savor the taste of grapes from these vines and verily I will swallow the seed of success buried in each and new life will sprout within me.";
JSONObject apiRequestBody = new JSONObject();
apiRequestBody.put("appId", appId);
apiRequestBody.put("sign", sign);
apiRequestBody.put("text", text);
String resultRequire = "both";
apiRequestBody.put("resultRequire", resultRequire);
String res = sendHttpPost(url, apiRequestBody.toString());
System.out.println(res);
JSONObject apiAssessReport = JSON.parseObject(res, JSONObject.class);
System.out.println(apiAssessReport);
- 响应结果展示
- 检验结果在传入的检测文本上标记
- 检测信息具体标记方式如下
{
// 请求状态
"status": "success",
// 错误信息
"errMsg": "",
// 错误码
"errCode": "10000",
// 响应结果
"response": {
// 文章检测结果
"detectionResults": [
{
// 命中
"hits": [
{
// 命中全文本偏移量
"offset": 37,
// 命中长度
"len": 3,
// 替换词
"replacements": [
"for too"
],
// 命中内容
"hitContent": "too"
}
],
// 命中描述
"description": "这里可能有<v>动词及物-不及物错误</v>,请参考修改。",
// 例句
"exampleList": [
{
"rawExample": "The students arrived the residency in Houston.",
"modifiedExample": [
"The students arrived at the residency in Houston."
]
}
],
// 检测内容解释
"explanation": "英语中按动词后可否直接跟宾语,可把动词分成及物动词和不及物动词。所谓及物动词,就是谓语动词不必通过介词引荐宾语,可以直接跟宾语。相反的,不及物动词表示的动作没有对象,只是表示某种状态,不能直接带宾语。"
},
{
"hits": [
{
"offset": 107,
"len": 5,
"replacements": [
" Today"
],
"hitContent": "Today"
}
],
"description": "Missing space between sentences",
"exampleList": [],
"explanation": null
},
{
"hits": [
{
"offset": 189,
"len": 5,
"replacements": [
" Today"
],
"hitContent": "Today"
}
],
"description": "Missing space between sentences",
"exampleList": [],
"explanation": null
},
{
"hits": [
{
"offset": 275,
"len": 4,
"replacements": [
", for"
],
"hitContent": ",for"
}
],
"description": "Use of whitespace before comma and before/after parentheses",
"exampleList": [],
"explanation": null
},
{
"hits": [
{
"offset": 353,
"len": 11,
"replacements": [
", generation"
],
"hitContent": ",generation"
}
],
"description": "Use of whitespace before comma and before/after parentheses",
"exampleList": [],
"explanation": null
},
{
"hits": [
{
"offset": 381,
"len": 5,
"replacements": [
" Today"
],
"hitContent": "Today"
}
],
"description": "Missing space between sentences",
"exampleList": [],
"explanation": null
}
],
// 报告
"report": {
// 可读性评语
"readabilityEvaluation": "可读性方面,用词、搭配和表达比较符合当前文体的风格,语言地道,行文逻辑非常连贯,表意明晰,语句几乎没有冗赘现象。词汇及语法方面,词汇的拼写和形式都很正确,语法的准确度高,标点符号使用得当。",
// 可读性评分
"readabilityScore": 82.45,
// 综合得分
"aggregateScore": 90.3475,
// 用词恰当得分
"wordScore": 76,
// 文体得分
"styleScore": 80,
// 简洁分数
"concisionScore": 87.5,
// 衔接与连贯分数
"logicScore": 83.333336,
// 拼写得分
"spellingScore": 100,
// 语法得分
"grammarScore": 100,
// 拼写与语法得分
"syntaxScore": 100,
// 标点符号分数
"punctuationScore": 100,
// 切题得分 (暂不开放)
"relevancyScore": 0,
// 写作文体 (通用 暂不开放其他文体)
"writingStyle": 2,
// 词数
"wordCount": 101,
// 标点个数
"punctCount": 8,
// 字符数
"charCount": 438,
// 句子数
"sentCount": 1,
"took": 0
},
// 花费时间
"took": 1836
}
}
响应
field | type | comment |
---|---|---|
response | json | 评估结果 |
status | String | 请求状态 |
errMsg | String | 错误类型 |
errCode | String | 错误码 |
响应字段
field | comment |
---|---|
detectionResults | 文章检测结果 |
detectionResults.hits | 命中 |
detectionResults.hits.offset | 命中全文本偏移量 |
detectionResults.hits.len | 命中长度 |
detectionResults.hits.replacements | 替换词 |
detectionResults.hits.hitContent | 命中内容 |
detectionResults.description | 规则描述 |
detectionResults.exampleList | 例句 |
detectionResults.explanation | 检测内容解释 |
report | 报告 |
report.readabilityEvaluation | 可读性评语 |
report.readabilityScore | 可读性评分 |
report.aggregateScore | 综合得分 |
report.wordScore | 用词恰当得分 |
report.styleScore | 文体适宜得分 |
report.concisionScore | 简洁分数 |
report.logicScore | 衔接与连贯分数 |
report.spellingScore | 拼写得分 |
report.grammarScore | 语法得分 |
report.syntaxScore | 拼写和语法得分 |
report.punctuationScore | 标点符号分数 |
report.relevancyScore | 切题得分 (暂不开放) |
report.writingStyle | 写作文体 (通用 暂不开放其他文体) |
report.wordCount | 词数 |
report.punctCount | 标点数 |
report.charCount | 字符数 |
report.sentCount | 句子数 |
took | 花费时间 |
错误码
errCode | errMsg | status | comment |
---|---|---|---|
10000 | "" | success | 请求成功 |
10001 | system error | fail | 系统错误 |
10002 | sign fail | fail | 签名错误 |
10000 | invalid app | fail | 无效应用 |
10001 | frozen app | fail | 已冻结的应用 |
10002 | text too long over 5000 | fail | 文本超限 |