JCJC错别字检测系统接口API文档更新,字典功能新增:错误词与正确词匹配
JCJC错别字检测功能字典支持类型:
- 1)黑名单(敏感词)
- 2)白名单
- 3)配对词:正确词 -> 错误词
Python 示例代码如下:
代码语言:javascript复制# coding=utf8
import requests,json
# JCJC错别字检测系统接口API文档-添加错误词与正确词匹配
def call_jcjc_add_pair_words_right_to_wrong():
msg_str_content_right = "正确词"
msg_str_content_2_wrong = "错误配对词"
payload = {
"content": msg_str_content_right,
"content2": msg_str_content_2_wrong,
"mode": "advanced",
"username": "用户名",
"biz_type": "show",
}
host_and_port = "localhost:8631" # 内网测试地址
url = 'http://' host_and_port '/spellcheck/add_pair_words_right_to_wrong'
headers = {'content-type': 'application/json'}
print("====>call payload ==>", json.dumps(payload))
response = requests.post(url, data=json.dumps(payload), headers=headers)
print("status:", response.status_code , response.encoding)
returned_json_str=response.content
print("raw http return string:", returned_json_str.decode('utf8'))
print("if 乱码 please encoding : https://github.com/sunuslee/practical-python-utf8 ")
if __name__ == "__main__":
call_jcjc_add_pair_words_right_to_wrong()
针对用户反馈,需要针对特殊的正确词与错误词配对提示的需求,我们新增了该接口。
接口地址为: /spellcheck/add_pair_words_right_to_wrong 。
参数说明:
- content: 正确词
- content2:错误词
词语新增完成后自动生效。
参考文档:
白名单、黑名单API 接口文档:
https://tianchunfeng.blog.csdn.net/article/details/116095794