项目介绍

czhang99/Capsule-NLU 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,目前获得 139 个 Star、27 次 Fork。

仓库全名
czhang99/Capsule-NLU
Star 数
139
Fork 数
27
未关闭 Issue
3

README 摘要

Joint Slot Filling and Intent Detection via Capsule Neural Networks This project provides tools for joint slot filling and intent detection via Capsule Neural Networks. Details about Capsule-NLU can be accessed here, and the implementation is based on the Tensorflow library. Quick Links Installation Usage Data Results Acknowledgements Installation For training, a GPU is recommended to accelerate the training speed…

完整内容见 GitHub 原始 README 或本页 。

常见问题

Capsule-NLU 用什么语言开发?

主要使用 Python 编写,目前有 139 个 Star。

如何获取 Capsule-NLU 的源码?

可以直接克隆仓库:git clone https://github.com/czhang99/Capsule-NLU.git,默认分支为 master;安装与运行步骤见仓库 README。

Capsule-NLU 最近还在维护吗?

仓库最近一次更新为 2023年3月25日,当前有 3 个未关闭 Issue;Star 数为 139,可作为社区活跃度的参考。

关于

Joint Slot Filling and Intent Detection via Capsule Neural Networks (ACL'19) https://arxiv.org/abs/1812.09471

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
196
价值分
91
活跃状态
活跃

语言占比

Python

README

Joint Slot Filling and Intent Detection via Capsule Neural Networks

This project provides tools for joint slot filling and intent detection via Capsule Neural Networks.

Details about Capsule-NLU can be accessed here, and the implementation is based on the Tensorflow library.

Installation

For training, a GPU is recommended to accelerate the training speed.

Tensorflow

The code is based on Tensorflow 1.5. You can find installation instructions here.

Dependencies

The code is written in Python 3.5. Its dependencies are summarized in the file requirements.txt.

tensorflow_gpu==1.5.0

numpy==1.14.0

six==1.11.0

scikit_learn==0.21.2

You can install these dependencies like this:

pip3 install -r requirements.txt

Usage

  • Run the full model on SNIPS-NLU dataset with default hyperparameter settings
    python3 train.py --dataset=snips

    Try run without early-stop python3 train.py --dataset=snips --no_early_stop --max_epochs=60

  • Run the model without re-routing on SNIPS-NLU dataset
    python3 train.py --dataset=snips --model_type=without_rerouting

  • For all available hyperparameter settings, use
    python3 train.py -h

Data

Format

Each dataset is a folder under the ./data folder, where each sub-folder indicates a train/valid/test split:

./data
└── snips
    ├── test
    │   ├── label
    │   ├── seq.in
    │   └── seq.out
    ├── train
    │   ├── label
    │   ├── seq.in
    │   └── seq.out
    └── valid
        ├── label
        ├── seq.in
        └── seq.out

In each sub-folder,

  • label file contains the intent label.
    e.g. AddToPlaylist

  • seq.in file contains utterances as the input sequences. Each line indicates one utterance and words are separated by a single space.
    e.g. add sabrina salerno to the grime instrumentals playlist

  • seq.out file contains ground truth slot labels. Each line indicates a sequence of slot labels and the BIO tagging scheme is used.
    e.g. O B-artist I-artist O O B-playlist I-playlist O

Work on your own data

Prepare and organize your dataset in a folder according to the format and put it under ./data/ and use --dataset=foldername during training.

For example, your dataset is ./data/mydata, then you need to use the flag --dataset=mydata for train.py.
Your dataset should be seperated to three folders - train, test, and valid, which is named ‘train’, ‘test’, and ‘valid’ by default setting of train.py. Each of these folders contain three files - word sequence, slot label, and intent label, which is named ‘seq.in’, ‘seq.out’, and ‘label’ by default setting of train.py.

Results

Model SNIPS-NLU ATIS
Slot (F1) Intent (Acc) Overall (Acc) Slot (F1) Intent (Acc) Overall (Acc)
CNN TriCRF - - - 0.944 - -
Joint Seq 0.873 0.969 0.732 0.942 0.926 0.807
Attention BiRNN 0.878 0.967 0.741 0.942 0.911 0.789
Slot-Gated Full Atten. 0.888 0.970 0.755 0.948 0.936 0.822
DR-AGG - 0.966 - - 0.914 -
IntentCapsNet - 0.974 - - 0.948 -
Capsule-NLU (our) 0.918 0.973 0.809 0.952 0.950 0.834

Acknowledgements

https://github.com/MiuLab/SlotGated-SLU

https://github.com/FudanNLP/Capsule4TextClassification

https://github.com/snipsco/nlu-benchmark/tree/master/2017-06-custom-intent-engines

Reference

@inproceedings{zhang2019joint,
  title={Joint slot filling and intent detection via capsule neural networks},
  author={Zhang, Chenwei and Li, Yaliang and Du, Nan and Fan, Wei and Yu, Philip S},
  booktitle={Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics (ACL)},
  year={2019}
}

评论

暂无评论