Code Monkey home page Code Monkey logo

ner's Introduction

NER

pytorch版的命名实体识别,LSTM 和 LSTM_CRF 结果对比

pytorch 官方CRF只能一条一条的样本进行解码,太慢了,该repo使用了基于AllenNLP实现的CRF包,速度可以保证。

数据集

人民日报中文数据集,data目录下,人名、地名、机构名三种实体的识别,TAG如下:

M_nt     1
E_ns     2
B_ns     3
B_nr     4
M_ns     5
O        6
E_nt     7
E_nr     8
B_nt     9
M_nr    10

requirements.txt

  1. pytorch
  2. pytorch-crf
  3. sklearn

运行

  1. 在data目录下运行
    • python data_renmin_word.py
  2. config.py 文件修改model参数,可选 NERLSTM 和 NERLSTM_CRF
  3. 运行 main.py
    • python main.py

结果

LSTM

lstm

LSTM_CRF

lstm_crf

结论

加CRF层不管在 micro_avg 还是 在 macro_avg 上平均有一个点的提升

ner's People

Contributors

hackerxiaobai avatar

Watchers

James Cloos avatar

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.