This is the source implementation of ACL2019 accepted paper: A Novel Bi-directional Interrelated Model for Joint Intent Detection and Slot Filling.
Our model🚀🚀🚀
The SF-ID network consists of an SF subnet and an ID subnet. The order of the SF and ID subnets can be customized. Depending on the order of the two subnets, the model have two modes: SF-First and ID-First. The former subnet can produce active effects to the latter one by a medium vector.
For training, a GPU is strongly recommended for speed. CPU is supported but training could be extremely slow.
Also create a folder named vocab
in the same directory as train.py
, this location will store the generated vocabulary files.
The code is based on Tensorflow and supports Tensorflow-gpu1.11.0 now . You can find installation instructions here.
The code is written in Python 3.5.2. Its dependencies are summarized in the file requirements.txt
. You can install these dependencies like this:
pip3 install -r requirements.txt
We mainly focus on the ATIS dataset and Snip dataset, and the code takes its original format as input. You should be able to get it here.
We assume the corpus is formatted as same as the ATIS dataset and Snips dataset. More specifically, seq.in, label and seq.out is our data files.
The input and output of the training data is as follows: The input is a sentence in seq.in in the format:
i want to fly from baltimore to dallas round trip
The output is divided into label output and sequence label output: The output of the label is in the label file in the format:
atis_flight
The output of the sequence label is in seq.out in the format:
O O O O O B-fromloc.city_name O B-toloc.city_name B-round_trip I-round_trip
- train.py: The code that is used to train the model containing SF-ID network.
- train_ID_only.py: The code that is used to train the train only containing SF subnet.
- train_SF_only.py: The code that is used to train the train only containing ID subnet.
- utils.py: It contains some functions relevant with data processing and the ev aluation of FI score in slot-filling task.
- data: It involves the data used in the experiments.
- atis: This file is about atis dataset, including train/valid/test set.
- snips: This file is about snips dataset, including train/valid/test set.
- dataset: It depends on which dataset is used in the experiment, atis or snips.
- priority_order: It depends on the execution order of the two subnets, slot-first or i ntent-first.
- use-crf: It depends on whether CRF layer is used, it is belongs to boolean type. W hen it is set as True, CRF layer is used.
- iteration number: It depends on the iteration number used in iteration mechanism.
Here we provide implementations for our models, it is SF-ID-Network. A command example is as follow:
python train.py --dataset=atis --priority_order=slot_first --use_crf=True
If you use the code, please cite the following paper: "A Novel Bi-directional Interrelated Model for Joint Intent Detection and Slot Filling" Haihong E, Peiqing Niu, Zhongfu Chen, Meina Song. ACL (2019)
@inproceedings{
under construction...
}