JCJC错别字检测系统API接口使用文档-添加黑名单、白名单词汇
JCJC錯別字檢測系統(tǒng)API接口使用文檔-添加黑名單、白名單詞匯
?
1、地址前綴:http://IP:PORT/spellcheck/
2、所有的接口調(diào)用:請使用 HTTP POST 方法,不支持 GET 方法
3、所有的接口調(diào)用:請使用 JSON POST 格式,不支持表單 FORM POST 的格式
4、字段:"content" 是需要提交的詞語
對于 JCJC SaaS 版本的用戶,地址前綴:
http://api.CuoBieZi.net/spellcheck/
對于 JCJC IaaS 版本的用戶,地址前綴:
http://IP:8631/spellcheck/
IP 為私有化部署的服務(wù)器IP
?
添加白名單詞匯:
http://IP:PORT/spellcheck/add_important_words
使用 JSON POST? 的方法,不支持 Form POST 的方法。
如下代碼所示:
# coding=utf8import requests,json#from jcjc_python_api import host_and_port #from jcjc_python_api import print_host_and_portdef call_jcjc_add_one_words_api():msg_str_content = "田春峰" msg_str_content = "中華人民共和國"payload = {"content" : msg_str_content,"mode": "advanced","username" : "tester","biz_type": "show",}host_and_port = "localhost:8631"url = 'http://'+ host_and_port +'/spellcheck/add_important_words'#print_host_and_port()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.contentprint("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_one_words_api()?
添加完成詞匯后,可以使用查詢接口,檢查插入的結(jié)果:
http://IP:PORT/spellcheck/list_words
可以參考 上述代碼 ,替換接口地址調(diào)用
?
添加敏感詞、黑名單詞匯的接口:
http://IP:PORT/spellcheck/add_sensitive_words
可以參考 上述代碼 ,替換接口地址調(diào)用
?
另外:
1)目前只支持簡體中文的字符,且字符之間不包含空格
2)不支持ASCII 字符的黑名單詞匯、白名單詞匯
3)添加詞匯是實時生效的
4)添加詞匯采用的異步機制,返回的狀態(tài)為接口調(diào)用是否成功的狀態(tài),不一定保證存儲到數(shù)據(jù)中
?
更詳細(xì)的說明請參考 PDF API 接口文檔:https://download.csdn.net/download/accesine960/17516787? 。
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
總結(jié)
以上是生活随笔為你收集整理的JCJC错别字检测系统API接口使用文档-添加黑名单、白名单词汇的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 详解Java算法之冒泡排序(Bubble
- 下一篇: CrowdSourcing-众包分析