- app.py是整个系统的主入口
- templates文件夹是HTML的页面
|——index.html 欢迎界面
|——search.html 搜索处方关系页面
|——all_relation.html 所有处方关系页面
|——KGQA.html 处方问答页面
- static文件夹存放css和js,是页面的样式和效果的文件
- raw_data文件夹是存在数据处理后的三元组文件
- neo_db文件夹是知识图谱构建模块
|——config.py 配置参数
|——create_graph.py 创建知识图谱,图数据库的建立
|——query_graph.py 知识图谱的查询
- KGQA文件夹是问答系统模块
|——ltp.py 分词、词性标注、命名实体识别
- spider文件夹是爬虫模块
|——get_*.py 是之前爬取人物资料的代码,已经产生好images和json 可以不用再执行
|——show_profile.py 是调用处方资料和图谱展示在前端的代码
- 0.安装所需的库 执行pip install -r requirement.txt
- 1.先下载好neo4j图数据库,并配好环境。修改neo_db目录下的配置文件config.py,设置图数据库的账号和密码。
- 2.切换到neo_db目录下,执行python create_graph.py 建立知识图谱
- 3.在spider目录下,运行data_process.py(已处理好)
- 4.在static目录下,运行neo2json.py(已处理好)
- 5.去这里下载好ltp模型。ltp简介
- 6.在KGQA目录下,修改ltp.py里的ltp模型文件的存放目录
- 7.运行python app.py,浏览器打开localhost:5000即可查看
欢迎界面
索引界面
问答界面
https://github.com/chizhu/KGQA_HLM