调用白蚁和texpress的python库及其处理结果

termite-toolkit的Python项目详细描述


项目说明

用于调用SciBite的ner引擎termite的python库,以及用于定义更复杂语义模式的texpress模块。 库还支持对此类请求返回的json进行后处理。

安装

$ pip3 install termite_toolkit

白蚁呼叫示例

fromtermite_toolkitimporttermitefrompprintimportpprint# specify termite API endpointtermite_home="http://localhost:9090/termite"# specify entities to annotateentities="DRUG"# initialise a request buildert=termite.TermiteRequestBuilder()# individually add items to your TERMite requestt.set_url(termite_home)t.set_fuzzy(True)t.set_text("citrate macrophage colony sildenafil stimulating factor influenza hedgehog")t.set_entities(entities)t.set_subsume(True)t.set_input_format("txt")t.set_output_format("doc.jsonx")t.set_reject_ambiguous(False)t.set_options({'fragmentSize':20})# execute the requesttermite_response=t.execute(display_request=True)pprint(termite_response)

调用texpress的示例

frompprintimportpprintfromtermite_toolkitimporttexpress# specify termite API endpointtermite_home="http://localhost:9090/termite"# specify the pattern you wish to search for- this can created in the TERMite UIpattern=":(INDICATION):{0,5}:(GENE)"t=texpress.TexpressRequestBuilder()# individually add items to your TERMite requestt.set_url(termite_home)t.set_text("breast cancer brca1")t.set_subsume(True)t.set_input_format("txt")t.set_output_format("json")t.set_allow_ambiguous(False)t.set_pattern(pattern)# execute the requesttexpress_response=t.execute(display_request=True)pprint(texpress_response)

许可证

知识共享署名非商业共享4.0国际许可。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
socketJava加密聊天客户端未通过关联   java保存JFileChooser的状态   java如何让代码等待GUI完成?   java可序列化和接口:Parcelable在写入可序列化对象时遇到IOException   java Jersey客户端将覆盖ROBOTS响应   java空指针异常&如何克服   java如何使用JAXR设置字符集?   JavaSpring自定义转换器被覆盖   java将泛型类型的值设置为DTO字段   使用netty的java音频流服务器   java滚动条添加到面板时不显示在滚动窗格中   java windows通过IIS Url重写单点登录tomcat   Web应用程序的java容器管理安全性   java使用mybatis将POJO项数组传递到存储过程?