Giter VIP home page Giter VIP logo

2020-kbqa's Introduction

基于BERT的KBQA系统

项目架构

基于NIPCC知识库问答数据集,利用BERT+BiLSTM+CRF进行命名实体识别,抽取问题中的实体。从知识库中提取实体相关的所有属性,利用BERT训练句子相似度计模型,计算问题与各属性之间的文本相似度,基于相似度对属性排序,最终得到问题答案。

目前只用了知识库实现(MySQL),后续会钻研一下知识图谱。

运行说明

下载文件:

数据集构建(请先更改data_config.py的MySQL配置):

$ mkdir data/NER
$ mkdir data/SIM
$ cd data_helper
$ python ner_data.py
$ python sim_data.py
$ python kb_data.py
$ cd ..

训练命名实体识别模型(NER):

$ cd ner
$ mkdir output
$ ./run_ner.sh
$ cd ..

ner/ner_config.py中的model_file=model/xxxxxxx更改为ner/output/model下的文件夹名称。

训练文本相似度模型(SIM):

$ cd sim
$ mkdir output
$ ./run_sim.sh
$ cd ..

sim/sim_config.py中的model_file=model/xxxxxxx更改为sim/output/model下的文件夹名称。

进行线上的问答测试:

$ python kbqa.py

效果如下:

环境

  • python 3.6.5
  • tensorflow 1.14
  • 云端训练:极客云-RTX 2080 Ti 双卡 Ryzen 9 3900X 24核32G 2TB SSD 网速D1000/U50

2020-kbqa's People

Contributors

yayoyy avatar

Stargazers

 avatar  avatar  avatar lixikun avatar Amy avatar 介介歪 avatar WU JUNCHAO avatar Kerwin Wilson avatar xinyi avatar  avatar  avatar  avatar dshwei avatar  avatar  avatar Donnie BurgsL avatar  avatar yitingyan avatar Hao Wang avatar XingWu_UCAS avatar

Watchers

James Cloos avatar  avatar

2020-kbqa's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.