From 47008bb4d6da3688b6a8379b7b8cd1257f0c4b11 Mon Sep 17 00:00:00 2001 From: adolphk-yk <49522434+adolphk-yk@users.noreply.github.com> Date: Sat, 22 Jun 2019 10:10:05 +0800 Subject: [PATCH] Modify sequence labeling tutorial (#69) * add sequence labeling in tutorial * add tag scheme convert script * add paper link * modify sequence labeling tutorial * modify senquence labeling tutorial --- Tutorial.md | 28 +++++++++++++++++++++++++--- Tutorial_zh_CN.md | 28 +++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/Tutorial.md b/Tutorial.md index fe8d95d..00a9cda 100644 --- a/Tutorial.md +++ b/Tutorial.md @@ -578,20 +578,42 @@ Sequence Labeling is an important NLP task, which includes NER, Slot Tagging, Po - ***Usages*** - 1. BiLSTM representation and Softmax output. + 1. Softmax output. ```bash + # train model cd PROJECT_ROOT python train.py --conf_path=model_zoo/nlp_tasks/slot_tagging/conf_slot_tagging.json + + # test model + cd PROJECT_ROOT + python test.py --conf_path=model_zoo/nlp_tasks/slot_tagging/conf_slot_tagging.json ``` + 2. CRF output. + ```bash + # train model + cd PROJECT_ROOT + python train.py --conf_path=model_zoo/nlp_tasks/slot_tagging/conf_slot_tagging_ccnn_wlstm_crf.json + + # test model + cd PROJECT_ROOT + python test.py --conf_path=model_zoo/nlp_tasks/slot_tagging/conf_slot_tagging_ccnn_wlstm_crf.json + ``` + *Tips: you can try more model in [here](https://github.com/microsoft/NeuronBlocks/tree/master/model_zoo/nlp_tasks/slot_tagging).* - ***Result*** - 1. BiLSTM representation and Softmax output. + The result on CoNLL 2003 English NER dataset. Model | F1-score -------- | -------- [Ma and Hovy(2016)](https://arxiv.org/pdf/1603.01354.pdf)|87.00 - BiLSTM+Softmax(NeuronBlocks)|88.50 + [BiLSTM+Softmax](https://github.com/microsoft/NeuronBlocks/blob/master/model_zoo/nlp_tasks/slot_tagging/conf_slot_tagging.json) (NeuronBlocks)|88.50 + [Lample et al.(2016)](https://arxiv.org/pdf/1603.01360.pdf)| 89.15 + [CLSTM+WLSTM+CRF](https://github.com/microsoft/NeuronBlocks/blob/master/model_zoo/nlp_tasks/slot_tagging/conf_slot_tagging_clstm_wlstm_crf.json) (NeuronBlocks)|90.83 + [Chiu and Nichols(2016)](https://www.mitpressjournals.org/doi/pdf/10.1162/tacl_a_00104)|90.91 + [CCNN+WLSTM+CRF](https://github.com/microsoft/NeuronBlocks/blob/master/model_zoo/nlp_tasks/slot_tagging/conf_slot_tagging_ccnn_wlstm_crf.json) (NeuronBlocks)|91.38 + + *Tips: C means Char and W means Word. CCNN means Char-level representation with CNN model and CLSTM means Char-level representation with LSTM model.* ## Advanced Usage diff --git a/Tutorial_zh_CN.md b/Tutorial_zh_CN.md index 53e6e60..dec8ca5 100644 --- a/Tutorial_zh_CN.md +++ b/Tutorial_zh_CN.md @@ -568,20 +568,42 @@ This task is to train a query-passage regression model to learn from a heavy tea - ***用法*** - 1. BiLSTM 词表示和 Softmax 输出 + 1. Softmax 输出. ```bash + # train model cd PROJECT_ROOT python train.py --conf_path=model_zoo/nlp_tasks/slot_tagging/conf_slot_tagging.json + + # test model + cd PROJECT_ROOT + python test.py --conf_path=model_zoo/nlp_tasks/slot_tagging/conf_slot_tagging.json ``` + 2. CRF 输出. + ```bash + # train model + cd PROJECT_ROOT + python train.py --conf_path=model_zoo/nlp_tasks/slot_tagging/conf_slot_tagging_ccnn_wlstm_crf.json + + # test model + cd PROJECT_ROOT + python test.py --conf_path=model_zoo/nlp_tasks/slot_tagging/conf_slot_tagging_ccnn_wlstm_crf.json + ``` + *提示 :尝试更多模型可 [点击](https://github.com/microsoft/NeuronBlocks/tree/master/model_zoo/nlp_tasks/slot_tagging)。* - ***结果*** - 1. BiLSTM 词表示和 Softmax 输出 + 实验采用 CoNLL 2003 英文 NER 数据集。 Model | F1-score -------- | -------- [Ma and Hovy(2016)](https://arxiv.org/pdf/1603.01354.pdf)|87.00 - BiLSTM+Softmax(NeuronBlocks)|88.50 + [BiLSTM+Softmax](https://github.com/microsoft/NeuronBlocks/blob/master/model_zoo/nlp_tasks/slot_tagging/conf_slot_tagging.json) (NeuronBlocks)|88.50 + [Lample et al.(2016)](https://arxiv.org/pdf/1603.01360.pdf)| 89.15 + [CLSTM+WLSTM+CRF](https://github.com/microsoft/NeuronBlocks/blob/master/model_zoo/nlp_tasks/slot_tagging/conf_slot_tagging_clstm_wlstm_crf.json) (NeuronBlocks)|90.83 + [Chiu and Nichols(2016)](https://www.mitpressjournals.org/doi/pdf/10.1162/tacl_a_00104)|90.91 + [CCNN+WLSTM+CRF](https://github.com/microsoft/NeuronBlocks/blob/master/model_zoo/nlp_tasks/slot_tagging/conf_slot_tagging_ccnn_wlstm_crf.json) (NeuronBlocks)|91.38 + + *提示 : C 代表字符,W 代表单词。 CCNN 代表使用 CNN 模型的字符级别表示, CLSTM 代表使用 LSTM 模型的字符级别表示。* ## 高阶用法