4

双文对比,在线纯文本文档差异比较 API 接口

 7 months ago
source link: https://blog.csdn.net/accesine960/article/details/133269331
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

双文对比,在线纯文本文档差异比较 API 接口

JCJC错别字检测-田春峰 于 2023-09-25 11:14:35 发布 阅读量95 点赞数

双文对比,在线纯文本文档差异比较 API 接口

文本对比 API 接口说明:

调用地址:http://api.cuobiezi.net/article/diff/json_result

请求方式:POST

请求格式:json

请求参数:

    username: 用户名

    content: 原文内容

    content2: 对比内容

返回内容:       

message 字符串,如果调用出错,会显示错误信息,调用成功,会显示空字符串

is_ok,调用成功,会显示 true,调用出错,会显示 false

html_content 字符串 ,对比结果的 html 内容,其中给<ins>表示增加内容,<del>表示删除内容。

ins_phrases_arr 数组:增加内容的数组,每个元素包含三个字段:hash_tag,content,pos。

del_phrases_arr 数组:删除内容的数组,每个元素包含三个字段:hash_tag,content,pos。

返回例子:        

"html_content":"\u003cspan\u003e这是一个\u003c/span\u003e\u003cdel style=\"background:#ffe6e6;\"\u003e\u003cspan id=\"ht_del_0\"\u003e1\u003c/span\u003e\u003c/del\u003e\u003cspan\u003e测试的\u003c/span\u003e\u003cins style=\"background:#e6ffe6;\"\u003e\u003cspan id=\"ht_ins_1\"\u003e2\u003c/span\u003e\u003c/ins\u003e\u003cspan\u003e内容\u003c/span\u003e",
newCodeMoreWhite.png

curl 的测试例子:

curl -X POST -H "Content-Type: application/json" -d '{"username":"test_user","content":"这是一个1测试的内容","content2":"这是一个测试的2内容"}' http://api.cuobiezi.net/article/diff/json_result

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK