thssmonkey / ARCH_KG

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

环境

python 3.7.7
neo4j 4.2.1
jieba 0.42.1
pyltp 0.4.0使用下载源码进行安装)
 $ git clone git@github.com:HIT-SCIR/pyltp.git
 $ cd pyltp
 $ git submodule init
 $ git submodule update
 $ python setup.py install
py2neo 2020.1.1

需要文本

规范文本词典库

运行代码的步骤

  1. 【kg_django/kg_building】运行buildSpecFromRawText.py。基于规范文本(final_text.txt)解析,生成规范原文.json(包含条目和规范正文)

  2. 【kg_django/kg_building】运行extract_main.py。基于规范原文.json,进行知识图谱识别,识别出其中的实体和三元组关系,生成knowledge_triple.json

  3. 【kg_django/kg_building】(可选)运行filter.py。基于词典库(lexicon.txt),对knowledge_triple.json进行过滤,把不包含在词典库的关系过滤掉,生成新的lexicon.json

  4. 【kg_django/kg_building】运行filter_repeat.py去除lexicon.json中的重复内容,生成lexicon.json

  5. 【kg_django/kg_building】运行renew_spec.py。基于规范原文.jsonlexicon.json,一个句子可能对应多个三元组,重新梳理,使每个句子的三元组的实体词汇都对应到相应句子中(用于网站标红),生成spec.json

    (上诉文件均在kg_django/kg_building/data中,运行下方kg_django时把lexicon.jsonspec.json复制到外层的kg_django/data中去)

  6. 【kg_django】运行write2neo4j.py。将lexicon.json输入到neo4j,进行知识图谱存储和生成知识图谱(有向的,write2neo4j(undir).py是生成无向图的,即双向的)(不用这个可视化,只是用来存储)

  7. 【kg_django】搭建的网站,是基于在neo4j存储的知识图谱(用于知识图谱关键词搜索、路径查询及整体的显示)和spec.json(用于规范原文信息以及标红的显示)运行的

About


Languages

Language:JavaScript 41.6%Language:Python 28.8%Language:HTML 23.2%Language:Shell 5.2%Language:CSS 1.3%