从零开始搭建医药领域知识图谱实现智能问答
白癜风该怎么治 http://m.39.net/pf/a_7461259.html从零开始搭建医药领域知识图谱实现智能问答与分析服务(含码源):含Neo4j基于垂直网站数据的医药知识图谱构建、医药知识图谱的自动问答等项目介绍 关于知识图谱概念性的介绍就不在此赘述。目前知识图谱在各个领域全面开花,如教育、医疗、司法、金融等。本项目立足医药领域,以垂直型医药网站为数据来源,以疾病为核心,构建起一个包含7类规模为4.4万的知识实体,11类规模约30万实体关系的知识图谱。 本项目将包括以下两部分的内容:1)基于垂直网站数据的医药知识图谱构建2)基于医药知识图谱的自动问答 项目效果展示以下两图是实际问答运行过程中的截图: 项目运行方式配置要求:要求配置neo4j数据库及相应的python依赖包。neo4j数据库用户名密码记住,并修改相应文件。知识图谱数据导入:pythonbuild_medicalgraph.py,导入的数据较多,估计需要几个小时。启动问答:pythonchat_graph.py 1.医疗知识图谱构建1.1业务驱动的知识图谱构建框架1.2脚本目录ppa_data/datasoider.py:网络资讯采集脚本 ppa_data/datasoider.py:网络资讯采集脚本 ppadata/maxcut.py:基于词典的最大向前/向后切分脚本 build_medicalgraph.py:知识图谱入库脚本 1.3医药领域知识图谱规模1.3.1neo4j图数据库存储规模1.3.2知识图谱实体类型1.3.3知识图谱实体关系类型1.3.4知识图谱属性类型2、基于医疗知识图谱的自动问答2.1技术架构2.2脚本结构question_classifier.py:问句类型分类脚本 question_parser.py:问句解析脚本 chatbot_graph.py:问答程序脚本 2.3 支持问答类型2.4问答结果展示部分代码展示: 针对不同的问题,分开进行处理defsql_transfer(self,question_type,entities):ifnotentities:turn[]#查询语句sql=[]#查询疾病的原因ifquestion_type==disease_cause:sql=["MATCH(m:Disease)whem.name={0}turnm.name,m.cause".format(i)foriinentities]#查询疾病的防御措施elifquestion_type==disease_pvent:sql=["MATCH(m:Disease)whem.name={0}turnm.name,m.pvent".format(i)foriinentities]#查询疾病的持续时间elifquestion_type==disease_lasttime:sql=["MATCH(m:Disease)whem.name={0}turnm.name,m.cu_lasttime".format(i)foriinentities]#查询疾病的治愈概率elifquestion_type==disease_cuprob:sql=["MATCH(m:Disease)whem.name={0}turnm.name,m.cud_prob".format(i)foriinentities]#查询疾病的治疗方式elifquestion_type==disease_cuway:sql=["MATCH(m:Disease)whem.name={0}turnm.name,m.cu_way".format(i)foriinentities]#查询疾病的易发人群elifquestion_type==disease_easyget:sql=["MATCH(m:Disease)whem.name={0}turnm.name,m.easy_get".format(i)foriinentities]#查询疾病的相关介绍elifquestion_type==disease_desc:sql=["MATCH(m:Disease)whem.name={0}turnm.name,m.desc".format(i)foriinentities]#查询疾病有哪些症状elifquestion_type==disease_symptom:sql=["MATCH(m:Disease)-[r:has_symptom]-(n:Symptom)whem.name={0}turnm.name,r.name,n.name".format(i)foriinentities]#查询症状会导致哪些疾病elifquestion_type==symptom_disease:sql=["MATCH(m:Disease)-[r:has_symptom]-(n:Symptom)when.name={0}turnm.name,r.name,n.name".format(i)foriinentities]#查询疾病的并发症elifquestion_type==disease_a |
转载请注明地址:http://www.dianqiecaoa.com/djccf/12265.html
- 上一篇文章: 街边甜过初恋的烤红薯,为什么能那么好吃
- 下一篇文章: 没有了