|
| 1 | +Sequence-to-Sequence with Attention Model for Text Summarization. |
| 2 | + |
| 3 | +Authors: |
| 4 | + |
| 5 | +Xin Pan ( [email protected], github :panyx0718), Peter Liu ( [email protected]) |
| 6 | + |
| 7 | +<b>Introduction</b> |
| 8 | + |
| 9 | +The core model is the traditional seqeuence-to-sequence model with attention. |
| 10 | +It is customized (mostly inputs/outputs) for the text summarization task. The |
| 11 | +model has been trained on Gigaword dataset and achieved state-of-the-art |
| 12 | +results (as of June 2016). |
| 13 | + |
| 14 | +The results described below are based on model trained on multi-gpu and |
| 15 | +multi-machine settings. It has been simplified to run on only one machine |
| 16 | +for open source purpose. |
| 17 | + |
| 18 | +<b>DataSet</b> |
| 19 | + |
| 20 | +We used the Gigaword dataset described in |
| 21 | +https://arxiv.org/pdf/1602.06023.pdf |
| 22 | + |
| 23 | +We cannot provide the dataset due to the license. See ExampleGen in data.py |
| 24 | +about the data format. data/data contains a toy example. Also see data/vocab |
| 25 | +for example vocabulary format. In <b>How To Run</b> below, users can use toy |
| 26 | +data and vocab provided in the data/ directory to run the training by replacing |
| 27 | +the data directory flag. |
| 28 | + |
| 29 | +<b>Experiment Result</b> |
| 30 | + |
| 31 | +8000 examples from testset are sampled to generate summaries and rouge score is |
| 32 | +calculated for the generated summaries. Here is the best rouge score on |
| 33 | +Gigaword dataset: |
| 34 | + |
| 35 | +ROUGE-1 Average_R: 0.38272 (95%-conf.int. 0.37774 - 0.38755) |
| 36 | + |
| 37 | +ROUGE-1 Average_P: 0.50154 (95%-conf.int. 0.49509 - 0.50780) |
| 38 | + |
| 39 | +ROUGE-1 Average_F: 0.42568 (95%-conf.int. 0.42016 - 0.43099) |
| 40 | + |
| 41 | +ROUGE-2 Average_R: 0.20576 (95%-conf.int. 0.20060 - 0.21112) |
| 42 | + |
| 43 | +ROUGE-2 Average_P: 0.27565 (95%-conf.int. 0.26851 - 0.28257) |
| 44 | + |
| 45 | +ROUGE-2 Average_F: 0.23126 (95%-conf.int. 0.22539 - 0.23708) |
| 46 | + |
| 47 | +<b>Configuration:</b> |
| 48 | + |
| 49 | +Following is the configuration for the best trained model on Gigaword: |
| 50 | + |
| 51 | +batch_size: 64 |
| 52 | + |
| 53 | +bidirectional encoding layer: 4 |
| 54 | + |
| 55 | +article length: first 2 sentences, total words within 120. |
| 56 | + |
| 57 | +summary length: total words within 30. |
| 58 | + |
| 59 | +word embedding size: 128 |
| 60 | + |
| 61 | +LSTM hidden units: 256 |
| 62 | + |
| 63 | +Sampled softmax: 4096 |
| 64 | + |
| 65 | +vocabulary size: Most frequent 200k words from dataset's article and summaries. |
| 66 | + |
| 67 | +<b>How To Run</b> |
| 68 | + |
| 69 | +Pre-requesite: |
| 70 | + |
| 71 | +Install TensorFlow and Bazel. |
| 72 | + |
| 73 | +```shell |
| 74 | +# cd to your workspace |
| 75 | +# clone the code to your workspace and create empty WORKSPACE file. |
| 76 | +# move the data to your workspace. If don't have full dataset yet, copy |
| 77 | +# the toy data from the data/ directory from code directory and rename |
| 78 | +# the files. |
| 79 | +ls -R |
| 80 | +.: |
| 81 | +data textsum WORKSPACE |
| 82 | + |
| 83 | +./data: |
| 84 | +vocab test-0 training-0 training-1 validation-0 ...(omitted) |
| 85 | + |
| 86 | +./textsum: |
| 87 | +batch_reader.py beam_search.py BUILD README.md seq2seq_attention_model.py data |
| 88 | +data.py seq2seq_attention_decode.py seq2seq_attention.py seq2seq_lib.py |
| 89 | + |
| 90 | +./textsum/data: |
| 91 | +data vocab |
| 92 | + |
| 93 | +bazel build -c opt --config=cuda textsum/... |
| 94 | + |
| 95 | +# Run the training. |
| 96 | +bazel-bin/textsum/seq2seq_attention \ |
| 97 | + --mode=train \ |
| 98 | + --article_key=article \ |
| 99 | + --abstract_key=abstract \ |
| 100 | + --data_path=data/training-* \ |
| 101 | + --vocab_path=data/vocab \ |
| 102 | + --log_root=textsum/log_root \ |
| 103 | + --train_dir=textsum/log_root/train |
| 104 | + |
| 105 | +# Run the eval. Try to avoid running on the same matchine as training. |
| 106 | +bazel-bin/textsum/seq2seq_attention \ |
| 107 | + --mode=eval \ |
| 108 | + --article_key=article \ |
| 109 | + --abstract_key=abstract \ |
| 110 | + --data_path=data/validation-* \ |
| 111 | + --vocab_path=data/vocab \ |
| 112 | + --log_root=textsum/log_root \ |
| 113 | + --eval_dir=textsum/log_root/eval |
| 114 | + |
| 115 | +# Run the decode. Run it when the most is mostly converged. |
| 116 | +bazel-bin/textsum/seq2seq_attention \ |
| 117 | + --mode=decode \ |
| 118 | + --article_key=article \ |
| 119 | + --abstract_key=abstract \ |
| 120 | + --data_path=data/test-* \ |
| 121 | + --vocab_path=data/vocab \ |
| 122 | + --log_root=textsum/log_root \ |
| 123 | + --decode_dir=textsum/log_root/decode \ |
| 124 | + --beam_size=8 |
| 125 | +``` |
| 126 | + |
| 127 | + |
| 128 | +<b>Examples:</b> |
| 129 | + |
| 130 | +The following are some text summarization examples, including experiments |
| 131 | +using dataset other than Gigaword. |
| 132 | + |
| 133 | +article: novell inc. chief executive officer eric schmidt has been named chairman of the internet search-engine company google . |
| 134 | + |
| 135 | +human: novell ceo named google chairman |
| 136 | + |
| 137 | +machine: novell chief executive named to head internet company |
| 138 | + |
| 139 | +====================================== |
| 140 | + |
| 141 | +article: gulf newspapers voiced skepticism thursday over whether newly re - elected us president bill clinton could help revive the troubled middle east peace process but saw a glimmer of hope . |
| 142 | + |
| 143 | +human: gulf skeptical about whether clinton will revive peace process |
| 144 | + |
| 145 | +machine: gulf press skeptical over clinton 's prospects for peace process |
| 146 | + |
| 147 | +====================================== |
| 148 | + |
| 149 | +article: the european court of justice ( ecj ) recently ruled in lock v british gas trading ltd that eu law requires a worker 's statutory holiday pay to take commission payments into account - it should not be based solely on basic salary . the case is not over yet , but its outcome could potentially be costly for employers with workers who are entitled to commission . mr lock , an energy salesman for british gas , was paid a basic salary and sales commission on a monthly basis . his sales commission made up around 60 % of his remuneration package . when he took two weeks ' annual leave in december 2012 , he was paid his basic salary and also received commission from previous sales that fell due during that period . lock obviously did not generate new sales while he was on holiday , which meant that in the following period he suffered a reduced income through lack of commission . he brought an employment tribunal claim asserting that this amounted to a breach of the working time regulations 1998 .....deleted rest for readability... |
| 150 | + |
| 151 | +abstract: will british gas ecj ruling fuel holiday pay hike ? |
| 152 | + |
| 153 | +decode: eu law requires worker 's statutory holiday pay |
| 154 | + |
| 155 | +====================================== |
| 156 | + |
| 157 | +article: the junior all whites have been eliminated from the fifa u - 20 world cup in colombia with results on the final day of pool play confirming their exit . sitting on two points , new zealand needed results in one of the final two groups to go their way to join the last 16 as one of the four best third place teams . but while spain helped the kiwis ' cause with a 5 - 1 thrashing of australia , a 3 - 0 win for ecuador over costa rica saw the south americans climb to second in group c with costa rica 's three points also good enough to progress in third place . that left the junior all whites hopes hanging on the group d encounter between croatia and honduras finishing in a draw . a stalemate - and a place in the knockout stages for new zealand - appeared on the cards until midfielder marvin ceballos netted an 81st minute winner that sent guatemala through to the second round and left the junior all whites packing their bags . new zealand finishes the 24 - nation tournament in 17th place , having claimed their first ever points at this level in just their second appearance at the finals . |
| 158 | + |
| 159 | +abstract: junior all whites exit world cup |
| 160 | + |
| 161 | +decoded: junior all whites eliminated from u- 20 world cup |
| 162 | + |
0 commit comments