2019-11-21 23:46:16 +08:00
|
|
|
|
# 开源web知识图谱项目
|
|
|
|
|
|
|
|
|
|
- 爬取百度百科中文页面
|
|
|
|
|
- 解析三元组和网页内容
|
|
|
|
|
- 构建中文知识图谱
|
|
|
|
|
- 构建百科bot(构建中)
|
2018-08-06 16:35:09 +08:00
|
|
|
|
|
2020-07-20 22:17:46 +08:00
|
|
|
|
##### update 20200720
|
|
|
|
|
|
|
|
|
|
Windows上的部署参考[如何在Windows上部署](https://github.com/lixiang0/WEB_KG/issues/20),感谢LMY-nlp0701!
|
|
|
|
|
|
2019-11-21 23:46:16 +08:00
|
|
|
|
##### update 20191121
|
|
|
|
|
|
|
|
|
|
- 迁移代码到爬虫框架scrapy
|
|
|
|
|
- 优化了抽取部分代码
|
|
|
|
|
- 数据持久化迁移到mongodb
|
|
|
|
|
- 修复chatbot失效问题
|
|
|
|
|
- 开放neo4j后台界面,可以查看知识图谱成型效果
|
|
|
|
|
|
|
|
|
|
##### Tips
|
2018-09-07 19:45:54 +08:00
|
|
|
|
|
|
|
|
|
- 如果是项目问题,请提issue。
|
|
|
|
|
- 如果涉及到不方便公开的,请发邮件。
|
2019-11-21 19:48:02 +08:00
|
|
|
|
- ChatBot请访问[链接](http://bot.rubenxiao.com/)
|
2019-11-22 00:09:41 +08:00
|
|
|
|
- 成型的百科知识图谱访问[链接](http://kg.rubenxiao.com/),用户名:neo4j,密码:123。效果如下:
|
|
|
|
|
![](imgs/kg6.png)
|
2018-04-24 14:43:30 +08:00
|
|
|
|
|
2018-01-15 15:56:26 +08:00
|
|
|
|
### 环境
|
|
|
|
|
|
|
|
|
|
- python 3.6
|
2018-05-21 20:21:49 +08:00
|
|
|
|
- re:url正则匹配
|
2019-11-21 23:46:16 +08:00
|
|
|
|
- scrapy:网页爬虫和网页解析
|
2018-05-24 10:30:10 +08:00
|
|
|
|
- neo4j:知识图谱图数据库,安装可以参考[链接](http://blog.rubenxiao.com/posts/install-neo4j.html)
|
2018-04-24 14:43:30 +08:00
|
|
|
|
- pip install neo4j-driver:neo4j python驱动
|
2019-11-21 23:46:16 +08:00
|
|
|
|
- pip install pymongodb:mongodb的python支持
|
|
|
|
|
- mongodb数据库:安装参考[链接](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/)
|
2018-01-15 15:56:26 +08:00
|
|
|
|
|
2018-05-21 20:21:49 +08:00
|
|
|
|
|
2019-11-21 23:46:16 +08:00
|
|
|
|
### 代码执行:
|
2018-05-21 20:21:49 +08:00
|
|
|
|
|
2019-11-21 23:46:16 +08:00
|
|
|
|
```
|
|
|
|
|
cd WEB_KG/baike
|
|
|
|
|
scrapy crawl baike
|
|
|
|
|
```
|
2018-01-15 15:56:26 +08:00
|
|
|
|
|
2019-11-21 23:46:16 +08:00
|
|
|
|
执行界面(按ctrl+c停止):
|
|
|
|
|
![](./imgs/kg5.png)
|
2018-01-15 15:56:26 +08:00
|
|
|
|
|
2019-11-21 23:46:16 +08:00
|
|
|
|
### 知识图谱效果图
|
2018-01-15 15:56:26 +08:00
|
|
|
|
|
2019-11-21 23:46:16 +08:00
|
|
|
|
![](./imgs/kg.png)
|
2018-09-07 19:53:03 +08:00
|
|
|
|
|
2019-11-21 23:46:16 +08:00
|
|
|
|
### mongodb存储的网页内容
|
2018-09-07 19:53:03 +08:00
|
|
|
|
|
2019-11-21 23:46:16 +08:00
|
|
|
|
![](./imgs/kg3.png)
|
2018-01-15 15:56:26 +08:00
|
|
|
|
|
2019-11-21 23:46:16 +08:00
|
|
|
|
### mongodb存储的三元组
|
|
|
|
|
|
|
|
|
|
![](./imgs/kg4.png)
|
|
|
|
|
|
|
|
|
|
### neo4j后台界面
|
2018-05-21 20:21:49 +08:00
|
|
|
|
|
2019-11-21 23:46:16 +08:00
|
|
|
|
![](./imgs/kg2.png)
|
2018-05-21 20:21:49 +08:00
|
|
|
|
|