Skip to content

This repository includes a set of tools that can help parsing data from cnki, extending information through reptile crawling from baidu baike, building knowledge graph in neo4j, and lastly a webui that can inquire on the knowledge graph.

License

Notifications You must be signed in to change notification settings

kingwingfly/knowledge_graph_builder_and_consultant

Repository files navigation

说明

本项目使用了较多新版本python的特性,如海象等式、类型标注等等,故需要较高python版本

推荐3.10.8

NLP Flask

用于快速调用LTP等工具,进行分词、语义、三元组抽取等操作。

运行set_up.py配置环境

模型请到哈工大的网站或hugging-face自行下载。

image

spider

应该叫crawler,但是懒得改了

pip install httpx安装依赖。

一个实现协程的百度百科爬虫。

其中:

  • depth 递归的深度,比如 词条A中,有B的超链接,B中有C的超链接,若爬取到C,则深度为3,只爬取B,深度为2,只爬取A,深度为1;
  • batch_size 每批次爬取的词条数目;
  • halt 两个批次间的暂停时间;

推荐depth设置为3 batch_size为16 halt为2

image

cnki_parser

用于解析从CNKI上下载的文献信息。

输入:

image

输出json文件:

image

cooperation_analyse

输入上一部分输出的json文件。

输出包含作者合作关系的json文件: {Author: [Article, [Authors]]···}

image

info_extension

信息扩展。

第一步,将cnki.json中的所有键全部转化为百度百科链接

第二步,从百度百科爬取所有信息,并保存

image

image

neo4j_builder

pip install py2neo安装依赖

neo4j console运行neo4j

修改neo4j_builder.py中的登陆密码

将info_extension得到的所有json以及cnki.json放入input

运行

image

inquire_sys

问答系统

pip install pyahocorasick安装依赖

运行app.py

打开localhost:8848即可

image

询问数字孪生的全部信息,结果如下(部分):

image

About

This repository includes a set of tools that can help parsing data from cnki, extending information through reptile crawling from baidu baike, building knowledge graph in neo4j, and lastly a webui that can inquire on the knowledge graph.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published