lightNLP:框架功能丰富,开箱即用
- 2019 年 10 月 28 日
- 筆記
AI项目体验地址 https://loveai.tech
依据自然语言处理四大任务等,框架主要设计为有以下五大功能:
- 序列标注, Sequence Labeling
- 文本分类, Text Classification
- 句子关系, Sentence Relation
- 文本生成, Text Generation
- 结构分析, Structure Parsing
因此将有五个主要的功能模块:sl(序列标注)、tc(文本分类)、sr(句子关系)、tg(文本生成)、sp(结构分析)和其他功能模块如we(词向量)。
当前已实现的功能
序列标注,sl
- 中文分词,cws
- 命名实体识别,ner
- 词性标注,pos
- 语义角色标注, srl
结构分析,sp
- 基于图的依存句法分析,gdp
- 基于转移的依存句法分析, tdp
句子关系,sr
- 语句相似度,ss
- 文本蕴含,te
文本分类,tc
- 关系抽取,re
- 情感极性分析,sa
文本生成,tg
- 语言模型,lm
- 聊天机器人,cb
- 机器翻译,mt
- 文本摘要,ts
词向量,we
- 词袋模型,cbow
- base
- hierarchical_softmax
- negative_sampling
- 跳字模型,skip_gram
- base
- hierarchical_softmax
- negative_sampling
安装
本项目基于Pytorch1.0
pip install lightNLP
建议使用国内源来安装,如使用以下命令:
pip install -i https://pypi.douban.com/simple/ lightNLP
模型
- ner: BiLstm-Crf
- cws: BiLstm-Crf
- pos: BiLstm-Crf
- srl:BiLstm-Crf
- sa: TextCnn
- re: TextCnn,当前这里只是有监督关系抽取
- lm: Lstm,基础的LSTM,没有使用Seq2Seq模型
- ss: 共享LSTM + 曼哈顿距离
- te:共享LSTM + 全连接
- tdp: lstm + mlp + shift-reduce(移入规约)
- gdp: lstm + mlp + biaffine(双仿射)
- cbow: base、hierarchical_softmax、negative_sampling
- skip_gram: base、hierarchical_softmax、negative_sampling
- cb: Seq2Seq+Attention
- mt: Seq2Seq+Attention
- ts: Seq2Seq+Attention