# Text Mining Based on the Lexicon-Constrained Network in the Context of Big Data

Authors: Boyan Wan; Mishal Sohail
Journal: Wireless Communications and Mobile Computing
 (2022)

---

## Abstract

Unstructured textual news data is produced every day; analyzing them using an abstractive summarization algorithm provides advanced analytics to decision-makers. Deep learning network with copy mechanism is finding increasing use in abstractive summarization, because copy mechanism allows sequence-to-sequence models to choose words from the input and put them directly into the output. However, since there is no explicit delimiter in Chinese sentences, most existing models for Chinese abstractive summarization can only perform character copy, resulting in inefficiency. To solve this problem, we propose a lexicon-constrained copying network that models multigranularity in both encoder and decoder. On the source side, words and characters are aggregated into the same input memory using a Transformer-based encoder. On the target side, the decoder can copy either a character or a multicharacter word at each time step, and the decoding process is guided by a word-enhanced search algorithm which facilitates the parallel computation and encourages the model to copy more words. Moreover, we adopt a word selector to integrate keyword information. Experiment results on a Chinese social media dataset show that our model can work standalone or with the word selector. Both forms can outperform previous character-based models and achieve competitive performances.


---

## Body

## 1. Introduction

In recent years, abstractive summarization [1] has made impressive progress with the development of sequence-to-sequence (seq2seq) framework [2, 3]. This framework is composed by an encoder and a decoder. The encoder processes the source text and extracts the necessary information for the decoder, which then predicts each word in the summary. Thanks to their generative nature, abstractive summaries can include novel expressions never seen in the source text, but at the same time, abstractive summaries are more difficult to produce compared with extractive summaries [4, 5] which are formed by directly selecting a subset of the source text.It has been also found that seq2seq-based abstractive methods usually struggle to generate out-of-vocabulary (OOV) words or rare words, even if those words can be found in the source text. Copy mechanism [6] can alleviate this problem and meanwhile maintain the expressive power of the seq2seq framework. The idea is to allow the decoder not only to generate a summary from scratch but also copy words from the source text.Though effective in English text summarization, the copy mechanism remains relatively undeveloped in the summarization of some East Asian languages, e.g., Chinese. Generally speaking, abstractive methods for Chinese text summarization come in two varieties, being word-based and character-based. Since there is no explicit delimiter in Chinese sentence to indicate word boundary, the first step of word-based methods [7] is to perform word segmentation [8, 9]. Actually, in order to avoid the segmentation error and to reduce the size of vocabulary, most of the existing methods are character-based [10–12]. When trying to combine the character-based methods in Chinese with copy mechanism, the original “word copy” degrades to “character copy” which does not guarantee a multicharacter word to be copied verbatim from the source text [13]. Unfortunately, copying multicharacter words is quite common in Chinese summarization tasks. Take the Large-Scale Chinese Social Media Text Summarization Dataset (LCSTS) [7] as an example; according to Table 1, about 37% of the words in the summaries are copied from the source texts and consist of multiple characters.Table 1
Percentage of different types of words that occur in the summaries of Chinese text summarization training data.
Word len.CopiedGenerated121.6%12.3%228.9%21.8%⩾37.6%7.7%Selective read [13] was proposed to handle this problem. It calculates the weighted sum of encoder states corresponding to the last generated character and adds this result to the input of the next decoding step. Selective read can provide location information of the source text for the decoder and help it to perform the consecutive copy. A disadvantage of this approach, however, is that it increases reliance of present computation on partial results before the current step which makes the model more vulnerable to the error accumulation and leads to exposure bias [14] during inference. Another way to make copied content consecutive is through directly copying text spans. Zhou et al. [15] implement span copy operation by equipping the decoder with a module that predicts the start and end positions of the span. Because a longer span can be decomposed to shorter ones, there are actually many different paths to generate the same summary during inference, but their model is optimized by only the longest common span at each time step during training, which exacerbates the discrepancy between two phases. In this work, we propose a novel lexicon-constrained copying network (LCN). The decoder of LCN can copy either a single character or a text span at a time, and we constrain the text span to match a potential multicharacter word. Specifically, given a text and several off-the-shell word segmentators, if a text span is included in any segmentation result of the text, we consider it as a potential word. By doing so, the number of available spans is significantly reduced, making it viable to marginalize over all possible paths during training. Furthermore, during inference, we aggregate all partial paths on the fly producing the same output using a word-enhanced beam search algorithm, which encourages the model to copy multicharacter words and facilitates the parallel computation.To be in line with the aforementioned decoder, the encoder should be revised to learn the representations of not only characters but also multicharacter words. In the context of neural machine translation, Su et al. [16] first organized characters and multicharacter words in a directed graph named word lattice. Following Xiao et al. [17], we adopt an encoder based on the Transformer [18] to take the word lattice as input and allow each character and word to have its own hidden representation. By taking into account relative positional information when calculating self-attention, our encoder can capture both global and local dependencies among tokens, providing an informative representation of source text for the decoder to make copy decisions.Although our model is character-based (because only characters are included in the input vocabulary), it can directly utilize word-level prior knowledge, such as keywords. In our setting, keywords refer to words in the source text that have a high probability of inclusion in the summary. Inspired by Gehrmann et al. [19], we adopt a separate word selector based on the large pretrained language model, e.g., BERT [20], to extract keywords. When the decoder intends to copy words from the source text, those selected keywords will be treated as candidates, and other words will be masked out. Experimental results show that our model can achieve better performance when incorporating with the word selector.


## 2. Related Work

Most existing neural methods to abstractive summarization fall into the sequence to sequence framework. Among them, models based on recurrent neural networks (RNNs) [21–23] are more common than those built on convolutional neural network (CNNs) [1, 24], because the former models can more effectively handle long sequences. Attention [3] is easily integrated with RNNs and CNNs, as it allows the model to focus more on salient parts of the source text [25, 26]. Also, it can serve as a pointer to select words in the source text for copying [6, 13]. In particular, architectures that are constructed entirely of attention, e.g., Transformer [18], can be adopted to capture global dependencies between source text and summary [19].Prior knowledge has proven helpful for generating informative and readable summaries. Templates that are retrieved from training data can guide summarization process at the sentence level when encoded in conjunction with the source text [27, 28]. Song et al. [29] show that the syntactic structure can help to locate the content that is worth keeping in the summary, such as the main verb. Keywords are commonly used in Chinese text summarization. When the decoder is querying from the source representation, Wang and Ren [30] use the keywords extracted by the unsupervised method to exclude noisy and redundant information. Deng et al. [31] propose a word-based model that not only utilizes keywords in the decoding process but also adds the keywords produced by the generative method into the vocabulary in the hope of alleviating out-of-vocabulary (OOV) problem. Our model is drastically different from the above two models in terms of the way keywords being extracted and encoded.The most related works are in the field of neural machine translation, in which many researchers resort to the assistance of multigranularity information. On the source side, Su et al. [16] use an RNN-based network to encode the word lattice, an input graph that contains both word and character. Xiao et al. [17] apply the lattice-structured input to the Transformer [18] and generalize the lattice to construct at a subword level. To fully take advantage of multihead attention in the Transformer, Nguyen et al. [32] first partition input sequence to phrase fragments based on n-gram type and then allow each head to attend to either one certain n-gram type or all different n-gram types at the same time. In addition to n-gram phrases, the multigranularity self-attention proposed by Hao et al. [33] also attends to syntactic phrases obtained from syntactic trees to enhance structure modeling. On the target side, when the decoder produces an UNK symbol which denotes a rare or unknown word, Luong et al. restore it to a natural word using a character-level component. Srinivasan et al. [34] adopt multiple decoders that map the same input into translations at different subword levels and combine all the translations into the final result, trying to improve the flexibility of the model without losing semantic information. While our model and the above models all utilize multigranularity information, our model differs at that we impose a lexical constraint on both encoding and decoding.


## 3. Model

This section describes our proposed model in detail.


### 3.1. Notations

Let character sequencex1:I=x1,⋯,xI be a source text; we can define a text span xi:j that starts with xi and ends with xj a potential word if it is contained by any word segmentation result of x1:I. Because both characters and words can be regarded as tokens, we include all characters and potential words of the source text in a token sequence o1:M=o1,⋯,oM.


### 3.2. Input Representation

Given a tokenom=x1,⋯,xl, where l is the token length (l=1 when om is a character), we first convert it into a sequence of vectors, using the character embedding Ec. Then, a bidirectional Long Short-Term Memory Network (bi-LSTM) is applied to model the token composition:
(1)gm=LSTM⟵Ecx1,LSTM⟶Ecxl,wheregm∈ℝd denotes the input token representation, which is formed by concatenating the backward state of the beginning character and the forward state of the ending character.Since the Transformer has no sequential structure, Vaswani et al. [18] proposed positional encoding to explicitly model the order of the sequence. In this work, we assign each token an absolute position which depends on the first character of the token. For example, the absolute position of the word “留学 (studying abroad)” in Figure 1 is the same as that of the character “留 (stay).” By adding the encoding of the absolute position to the token representation, we can get the final input representation G=g1,⋯,gM.Figure 1
Structure overview of the proposed model.


### 3.3. Encoder

However, absolute position alone cannot precisely reflect the relationship among tokens. Consider again the example in Figure1; the distance between the word “留学 (studying abroad)” and the character “生 (life)” is 2 according to their absolute positions, but they are actually neighboring tokens in a certain segmentation. To alleviate this problem, Xiao et al. [17] extend the Transformer [18] by taking into account relation types when calculating self-attention. In this work, we adopt relative position as an alternative to relation type. The main idea is that relative position is complementary to absolute position and can guide each token to interact with other tokens in a coherent manner. Given two tokens xa:b and xc:d that correspond to a span of the source text each, the position of xc:d relative to xa:b is determined by both their beginning and ending characters as shown in Table 2. Following Xiao et al. [17], we revise self-attention to integrate relative positional information. Concretely, a self-attention layer consists of h heads, which operate in parallel on a sequence H=h1,⋯,hM of context vectors with dimension d. After modification, the resulting output attn for each attention head is defined as
(2)eij=WqhiWkhj+pijkTdz,aij=expeij∑k=1Mexpeik,attni=∑j=1MaijWvhj+pijv,where Wq, Wk, and Wv∈ℝdz×d are all model parameters, dz=d/h is the hidden dimension for each head, and pijk and pijv are learned embeddings that encode the position of token tj relative to token ti. We concatenate the outputs of all heads to restore their dimension to d and then apply other sublayers (such as feed-forward layer) used in the original Transformer [18] to get the final output of the layer. Several identical self-attention layers are stacked to build our encoder. For the first layer, H is input representation G. For the subsequent layers, H is the output of the previous layer.Table 2
Position ofxc:d relative to xa:b under different conditions. Constant r is used to limit the relative position from 0 to 2r+3, where 2r+1 to 2r+3 each represent special cases: xc:d includes xa:b, xc:d is included in xa:b, and xc:d intersects with xa:b.
ConditionsRelative positiond<amax0,r−a+da=c and b=drb<cmin2r,r+c−bc≤a≤b<d or c<a≤b≤d2r+1a≤c≤d<b or a<c≤d≤b2r+2Otherwise2r+3


### 3.4. Decoder

The encoder proposed by Xiao et al. [17] takes both characters and words as input and thus has the ability to learn multigranularity representations. However, as their decoder is character-based which consumes and outputs only characters, the word representations induced from the encoder cannot receive supervision signal directly from the decoder and remain a subsidiary part of the input memory. To alleviate this problem, we extend the standard Transformer decoder by a lexicon-constrained copying module, which not only allows the decoder to perform multicharacter word copy but also provides auxiliary supervision on word representations. Specifically, at each time step t, we leverage a single-head attention over the input memory H=h1,⋯,hM and the decoder hidden state st to produce copy distribution at and context vector ct:
(3)etj=WcopyqstWcopykhjTd,(4)atj=expetj∑k=1Mexpetk,(5)ct=∑j=1MatjWcopyvhj.In addition to the predefined character vocabularyV and a special token UNK denoting any out-of-vocabulary token, lexicon-constrained copying module expands the output space by two sets C and W, consisting of characters and multicharacter words that appear in the source text, respectively, so that the probability of emitting any token o at time step t is
(6)Po∣⋅=pgengeno+pcopy∑i:oi=oati,o∈V∪C,pcopy∑i:oi=oati,o∈W,pgengenUNK,otherwise,where pgen and pcopy∈0,1 control the decoder switching between generation mode and copy mode and gen⋅ provide a probability distribution over character vocabulary V:
(7)pgen=σVgst,ct+bp,pcopy=1−pgen,gen⋅=softmaxVg^Vgst,ct+b+bg^,where σ⋅ is the sigmoid function.With the introduction of lexicon-constrained copying module, our decoder can predict tokens of variable lengths at each time step and thereby can generate any segmentation of a sentence. Naturally, we expect to evaluate the probability of a summary by marginalizing over all its segmentations. For example, the probability of a summary consisting of only one word “北京 (BeiJing)” can be factorized as(8)PBei,Jing=PBei∣ϵPJing∣BeiPϵ∣Bei,Jing+PBeiJing∣ϵPϵ∣BeiJing,where each term corresponds to a segmentation and is the product of conditional probabilities; we use ϵ to denote either the beginning or end of a sentence. Note that the conditional probability here depends on the current segmentation, which means the decoder directly take tokens in a segmentation as input. However, if we feed the decoder with character-level input and reformulate the conditional probability, the above probability can be rewritten as
(9)PBei,Jing=Pϵ∣Bei,JingPBei∣ϵPJing∣Bei+PBeiJing∣ϵ,where we factor out Pϵ∣Bei,Jing, because it is shared by two different segmentations. As can be seen from the above example, the assumption that conditional probability of a token depends only on its preceding character sequence facilitates the reuse of computation and thus makes it feasible to apply dynamic programming. Formally, let character sequence y1:J=y1,⋯,yJ be a summary; its probability can be represented as a recursion:
(10)Py1:J=∑o∈V∪C∪Wo=yJ−ℓ+1:JPo∣y1:J−ℓPy1:J−ℓ.Note that all the aboveP⋅ are inevitably conditioned on the source text, so we omit it for simplicity. We train the model by maximizing Py1:J for all training pair in the dataset.During inference, since there is no access to the ground truth, we need a search algorithm which can guide the generation of the summary in a left-to-right fashion. Beam search [35] is the most common search algorithm in seq2seq frameworks, but cannot be used directly in our scenario. To illustrate this, we first define hypothesis as a partial output that consists of tokens. Hypotheses can be further divided into character hypotheses and word hypotheses based on whether their last token is a character or a multicharacter word. For hypotheses within a beam, the standard beam search algorithm updates states for them by feeding their last tokens to the decoder and then generates new hypotheses through suffixing them with a token sampled from the model’s distribution. Because our decoder is designed to take only characters as input, multiple decoder steps are required to update the state for a word hypothesis. As a result, it is difficult to conduct batched update for a beam containing both word hypotheses and character hypotheses. To this end, we proposed a novel word-enhanced beam search algorithm, where the beam is also split into two parts: the character beam and the word beam. The word beam is used to update the states for word hypotheses. When their states are fully updated, word hypotheses are placed into the character beam (see lines 5-8 of Algorithm 1). Note that we do not perform generation step for word hypotheses in the word beam, that is to say, with the same length, the more multicharacter words a hypothesis includes, the more generation steps it can skip, which may give it a higher probability.Algorithm 1: Pseudocode for word-enhanced beam search.
Input: model, source, maximum summary length L, beam size k1:startHyp⟵getStartHypϵ2:Bc=startHyp,Bw= and Bf=3:fort=0; t++; t<Ldo4:n,m=5:Bc,Bw⟵model.batchedUpdateBc,Bw,source//Batched update for hypos in bothBc and Bw6:forhyp∈Bwdo7:if hyp is Updated then8:    move hyp intoBc9:end if10:end for11:  Merge hypos of the same character sequence inBc12:n⟵model.generateBc//Generating new hypotheses and their respectivelog probabilities fromBc13:forhyp∈ndo14:if hyp ends with a multicharacter word then15:    Move hyp fromn into m16:end if17:end for18:Bw⟵k−argmaxhyp∈mhyp.avgLogProb19:Bc⟵k−argmaxhyp∈nhyp.avgLogProb20:forhyp∈Bcdo21:if hyp ends with ϵ or hyp.len=Lthen22:    Move hyp fromn into Bf23:end if24:end for25:end for26:finalHyp⟵argmaxhyp∈Bf hyp.avgLogProb27:return finalHyp


### 3.5. Word Selector

We treat keyword selection as a binary classification task on each potential word. To obtain word representations, we first leverage BERT [20], a pretrained language model to produce context-aware representations xc for all characters in the source text and then feed them to a bi-LSTM network. Different from Section 3.2 where bi-LSTM is applied to character sequence of each word, here the bi-LSTM takes the whole source character representations as input, in an attempt to build word representation that can reflect how much contextual information the word carries. Given a potential word xa:b, where a and b are indexes of characters in the source text, we can calculate its final representation t as follows:
(11)da⟶=LSTM⟶xac,db⟶=LSTM⟶xbc,da⟵=LSTM⟵xac,db⟵=LSTM⟵xbc,t=da⟶,db⟶,da⟵,db⟵,db⟶−da⟶,da⟵−db⟵.Then, a linear transformation layer and a sigmoid function can be used sequentially on its final representation to compute the probability of xa:b being selected.During training, words that appear in both summary and source text are considered as positives, and the rest are negatives. To make sure that decoder can access the entire source character sequence at inference time, in addition to the multicharacter words with thetop−n probability, we treat all characters in source text as keywords. Inspired by [19], we utilize keyword information by masking out other words when calculating copy distribution. In particular, we leave etj in Equation (4) unchanged for keywords and set etj to zero for the rest of the words.


## 3.1. Notations

Let character sequencex1:I=x1,⋯,xI be a source text; we can define a text span xi:j that starts with xi and ends with xj a potential word if it is contained by any word segmentation result of x1:I. Because both characters and words can be regarded as tokens, we include all characters and potential words of the source text in a token sequence o1:M=o1,⋯,oM.


## 3.2. Input Representation

Given a tokenom=x1,⋯,xl, where l is the token length (l=1 when om is a character), we first convert it into a sequence of vectors, using the character embedding Ec. Then, a bidirectional Long Short-Term Memory Network (bi-LSTM) is applied to model the token composition:
(1)gm=LSTM⟵Ecx1,LSTM⟶Ecxl,wheregm∈ℝd denotes the input token representation, which is formed by concatenating the backward state of the beginning character and the forward state of the ending character.Since the Transformer has no sequential structure, Vaswani et al. [18] proposed positional encoding to explicitly model the order of the sequence. In this work, we assign each token an absolute position which depends on the first character of the token. For example, the absolute position of the word “留学 (studying abroad)” in Figure 1 is the same as that of the character “留 (stay).” By adding the encoding of the absolute position to the token representation, we can get the final input representation G=g1,⋯,gM.Figure 1
Structure overview of the proposed model.


## 3.3. Encoder

However, absolute position alone cannot precisely reflect the relationship among tokens. Consider again the example in Figure1; the distance between the word “留学 (studying abroad)” and the character “生 (life)” is 2 according to their absolute positions, but they are actually neighboring tokens in a certain segmentation. To alleviate this problem, Xiao et al. [17] extend the Transformer [18] by taking into account relation types when calculating self-attention. In this work, we adopt relative position as an alternative to relation type. The main idea is that relative position is complementary to absolute position and can guide each token to interact with other tokens in a coherent manner. Given two tokens xa:b and xc:d that correspond to a span of the source text each, the position of xc:d relative to xa:b is determined by both their beginning and ending characters as shown in Table 2. Following Xiao et al. [17], we revise self-attention to integrate relative positional information. Concretely, a self-attention layer consists of h heads, which operate in parallel on a sequence H=h1,⋯,hM of context vectors with dimension d. After modification, the resulting output attn for each attention head is defined as
(2)eij=WqhiWkhj+pijkTdz,aij=expeij∑k=1Mexpeik,attni=∑j=1MaijWvhj+pijv,where Wq, Wk, and Wv∈ℝdz×d are all model parameters, dz=d/h is the hidden dimension for each head, and pijk and pijv are learned embeddings that encode the position of token tj relative to token ti. We concatenate the outputs of all heads to restore their dimension to d and then apply other sublayers (such as feed-forward layer) used in the original Transformer [18] to get the final output of the layer. Several identical self-attention layers are stacked to build our encoder. For the first layer, H is input representation G. For the subsequent layers, H is the output of the previous layer.Table 2
Position ofxc:d relative to xa:b under different conditions. Constant r is used to limit the relative position from 0 to 2r+3, where 2r+1 to 2r+3 each represent special cases: xc:d includes xa:b, xc:d is included in xa:b, and xc:d intersects with xa:b.
ConditionsRelative positiond<amax0,r−a+da=c and b=drb<cmin2r,r+c−bc≤a≤b<d or c<a≤b≤d2r+1a≤c≤d<b or a<c≤d≤b2r+2Otherwise2r+3


## 3.4. Decoder

The encoder proposed by Xiao et al. [17] takes both characters and words as input and thus has the ability to learn multigranularity representations. However, as their decoder is character-based which consumes and outputs only characters, the word representations induced from the encoder cannot receive supervision signal directly from the decoder and remain a subsidiary part of the input memory. To alleviate this problem, we extend the standard Transformer decoder by a lexicon-constrained copying module, which not only allows the decoder to perform multicharacter word copy but also provides auxiliary supervision on word representations. Specifically, at each time step t, we leverage a single-head attention over the input memory H=h1,⋯,hM and the decoder hidden state st to produce copy distribution at and context vector ct:
(3)etj=WcopyqstWcopykhjTd,(4)atj=expetj∑k=1Mexpetk,(5)ct=∑j=1MatjWcopyvhj.In addition to the predefined character vocabularyV and a special token UNK denoting any out-of-vocabulary token, lexicon-constrained copying module expands the output space by two sets C and W, consisting of characters and multicharacter words that appear in the source text, respectively, so that the probability of emitting any token o at time step t is
(6)Po∣⋅=pgengeno+pcopy∑i:oi=oati,o∈V∪C,pcopy∑i:oi=oati,o∈W,pgengenUNK,otherwise,where pgen and pcopy∈0,1 control the decoder switching between generation mode and copy mode and gen⋅ provide a probability distribution over character vocabulary V:
(7)pgen=σVgst,ct+bp,pcopy=1−pgen,gen⋅=softmaxVg^Vgst,ct+b+bg^,where σ⋅ is the sigmoid function.With the introduction of lexicon-constrained copying module, our decoder can predict tokens of variable lengths at each time step and thereby can generate any segmentation of a sentence. Naturally, we expect to evaluate the probability of a summary by marginalizing over all its segmentations. For example, the probability of a summary consisting of only one word “北京 (BeiJing)” can be factorized as(8)PBei,Jing=PBei∣ϵPJing∣BeiPϵ∣Bei,Jing+PBeiJing∣ϵPϵ∣BeiJing,where each term corresponds to a segmentation and is the product of conditional probabilities; we use ϵ to denote either the beginning or end of a sentence. Note that the conditional probability here depends on the current segmentation, which means the decoder directly take tokens in a segmentation as input. However, if we feed the decoder with character-level input and reformulate the conditional probability, the above probability can be rewritten as
(9)PBei,Jing=Pϵ∣Bei,JingPBei∣ϵPJing∣Bei+PBeiJing∣ϵ,where we factor out Pϵ∣Bei,Jing, because it is shared by two different segmentations. As can be seen from the above example, the assumption that conditional probability of a token depends only on its preceding character sequence facilitates the reuse of computation and thus makes it feasible to apply dynamic programming. Formally, let character sequence y1:J=y1,⋯,yJ be a summary; its probability can be represented as a recursion:
(10)Py1:J=∑o∈V∪C∪Wo=yJ−ℓ+1:JPo∣y1:J−ℓPy1:J−ℓ.Note that all the aboveP⋅ are inevitably conditioned on the source text, so we omit it for simplicity. We train the model by maximizing Py1:J for all training pair in the dataset.During inference, since there is no access to the ground truth, we need a search algorithm which can guide the generation of the summary in a left-to-right fashion. Beam search [35] is the most common search algorithm in seq2seq frameworks, but cannot be used directly in our scenario. To illustrate this, we first define hypothesis as a partial output that consists of tokens. Hypotheses can be further divided into character hypotheses and word hypotheses based on whether their last token is a character or a multicharacter word. For hypotheses within a beam, the standard beam search algorithm updates states for them by feeding their last tokens to the decoder and then generates new hypotheses through suffixing them with a token sampled from the model’s distribution. Because our decoder is designed to take only characters as input, multiple decoder steps are required to update the state for a word hypothesis. As a result, it is difficult to conduct batched update for a beam containing both word hypotheses and character hypotheses. To this end, we proposed a novel word-enhanced beam search algorithm, where the beam is also split into two parts: the character beam and the word beam. The word beam is used to update the states for word hypotheses. When their states are fully updated, word hypotheses are placed into the character beam (see lines 5-8 of Algorithm 1). Note that we do not perform generation step for word hypotheses in the word beam, that is to say, with the same length, the more multicharacter words a hypothesis includes, the more generation steps it can skip, which may give it a higher probability.Algorithm 1: Pseudocode for word-enhanced beam search.
Input: model, source, maximum summary length L, beam size k1:startHyp⟵getStartHypϵ2:Bc=startHyp,Bw= and Bf=3:fort=0; t++; t<Ldo4:n,m=5:Bc,Bw⟵model.batchedUpdateBc,Bw,source//Batched update for hypos in bothBc and Bw6:forhyp∈Bwdo7:if hyp is Updated then8:    move hyp intoBc9:end if10:end for11:  Merge hypos of the same character sequence inBc12:n⟵model.generateBc//Generating new hypotheses and their respectivelog probabilities fromBc13:forhyp∈ndo14:if hyp ends with a multicharacter word then15:    Move hyp fromn into m16:end if17:end for18:Bw⟵k−argmaxhyp∈mhyp.avgLogProb19:Bc⟵k−argmaxhyp∈nhyp.avgLogProb20:forhyp∈Bcdo21:if hyp ends with ϵ or hyp.len=Lthen22:    Move hyp fromn into Bf23:end if24:end for25:end for26:finalHyp⟵argmaxhyp∈Bf hyp.avgLogProb27:return finalHyp


## 3.5. Word Selector

We treat keyword selection as a binary classification task on each potential word. To obtain word representations, we first leverage BERT [20], a pretrained language model to produce context-aware representations xc for all characters in the source text and then feed them to a bi-LSTM network. Different from Section 3.2 where bi-LSTM is applied to character sequence of each word, here the bi-LSTM takes the whole source character representations as input, in an attempt to build word representation that can reflect how much contextual information the word carries. Given a potential word xa:b, where a and b are indexes of characters in the source text, we can calculate its final representation t as follows:
(11)da⟶=LSTM⟶xac,db⟶=LSTM⟶xbc,da⟵=LSTM⟵xac,db⟵=LSTM⟵xbc,t=da⟶,db⟶,da⟵,db⟵,db⟶−da⟶,da⟵−db⟵.Then, a linear transformation layer and a sigmoid function can be used sequentially on its final representation to compute the probability of xa:b being selected.During training, words that appear in both summary and source text are considered as positives, and the rest are negatives. To make sure that decoder can access the entire source character sequence at inference time, in addition to the multicharacter words with thetop−n probability, we treat all characters in source text as keywords. Inspired by [19], we utilize keyword information by masking out other words when calculating copy distribution. In particular, we leave etj in Equation (4) unchanged for keywords and set etj to zero for the rest of the words.


## 4. Experiments

### 4.1. Datasets and Evaluation Metric

We conduct experiments on the Large-Scale Chinese Social Media Text Summarization Dataset (LCSTS) [7], which consists of source texts with no more than 140 characters, along with human-generated summaries. The dataset is divided into three parts; the (source, summary) pairs in PART II and PART III are scored manually from 1 to 5, with higher scores indicating more relevance between the source text and its summary. Following Hu et al. [7], after removing pairs with scores less than 3, PART I, PART II, and PART III are used as training set, verification set, and test set, respectively, with 2.4M pairs in PART I, 8K pairs in PART II, and 0.7K pairs in PART III.We choose ROUGE score [36] as our evaluation metric, which is widely used for evaluating automatically produced summaries. The metric measure the relevance between a source text and its summary based on their cooccurrence statistics. In particular, ROUGE-1 and ROUGE-2 depend on unigram and bigram overlap, respectively, while ROUGE-L relies on the longest common subsequence.


### 4.2. Experimental Setup

The character vocabulary is formed by 4000 most frequent characters in the training set. To get all potential words, we use PKUSEG [37], a toolkit for multidomain Chinese word segmentation. Specifically, there are separate segmentators for four domains, including web, news, medicine, and tourism. We use these segmentators for the source text, and if a text span is included in any of word segmentation results, we regard it as a potential word.For the lexicon-constrained copying network, we employ six attention layers of 8 heads for both encoder and decoder. Constantr in Table 2 is set to 8. We make character embedding and all hidden vectors the same dimension of 512 and set the filter size of feed-forward layers to 1024. For word selectors, we use a single-layer Bi-LSTM with a hidden size of 512.During training, we update the parameters of the lexicon-constrained copying network (LCCN) and word selector by Adam optimizer withβ1=0.9, β2=0.98, and ε=10−9. The same learning rate schedule of Vaswani et al. [18] is used to the LCCN, while a fixed learning rate of 0.0003 is set for word selector. The BERT we use in the word selector is pretrained on Chinese corpus by Wolf et al. [38] and we freeze its parameters throughout the training.During testing, we use a beam size of 10 and take the first 10 multicharacter words predicted by the word selector and all characters in the source text as keywords.


### 4.3. Baselines

(i)
RNN and RNN-Context are seq2seq baselines provided along with the LCSTS dataset by Hu et al. [7]. Both of them have GRU encoder and GRU decoder, while RNN-Context has an additional attention mechanism(ii)
COPYNET integrates copying mechanism into the seq2seq framework, trying to improve both content-based addressing and location-based addressing(iii)
Supervision with Autoencoder (superAE) uses an autoencoder trained on the summaries to provide auxiliary supervision for the internal representation of seq2seq. Moreover, adversarial learning is adopted to enhance this supervision(iv)
Global Encoding refines source representation with consideration of the global context by using a convolutional gated unit(v)
Keyword and Generated Word Attention (KGWA) exploits relevant keywords and previously generated words to learn accurate source representation and to alleviate the information loss problem(vi)
Keyword Extraction and Summary Generation (KESG) first uses a separate seq2seq model to extract keywords and then utilize keyword information to improve the quality of the summarization(vii)
Transformer and CopyTransformer are our implementations of the Transformer framework in the task of summarization. Copy mechanism is incorporated into CopyTransformer


### 4.4. Results

Table3 records the results of our LCCN model and other seq2seq models on the LCSTS dataset. To begin with, we first compare two Transformer baselines. We can see that CopyTransformer outperforms vanilla Transformer by 0.8 ROUGE-1, 0.6 ROUGE-2, and 0.3 ROUGE-L, showing the importance of copy mechanism. The gap between our LCCN and vanilla Transformer is further widened to 1.8 ROUGE-1, 2.1 ROUGE-2, and 2.5 ROUGE-L, which asserts the superiority of lexicon-constrained copying over character-based copying. Compared to other latest models, our LCCN can achieve state-of-the-art performance in terms of ROUGE-1 and ROUGE-2 and is second only to the KGWA in terms of ROUGE-L. When also using keyword information as the KGWA does, LCCN+word selector further improves the performance and overtakes the KGWA by 0.2 ROUGE-L. We also conduct an ablation study by removing the word-enhanced beam search in LCCN, denoted by w/o word-enhanced beam search in Table 3. It shows that word-enhanced beam search can boost the performance of 1.7 ROUGE-1, 1.0 ROUGE-2, and 0.9 ROUGE-L.Table 3
Results of different models. We use† to indicate that the model utilizes keyword information.
ModelsROUGE-1ROUGE-2ROUGE-LRNN [7]21.58.918.6RNN-Content [7]29.917.427.2COPYNET [13]34.421.631.3superAE [11]39.226.036.2Global Encoding [10]39.426.936.5KESG† [31]39.428.435.3KGWA† [30]40.928.338.2Transformer38.927.435.5CopyTransformer39.728.035.8LCCN41.729.538.0w/o word-enhanced beam search40.028.537.1LCCN+word selector†42.329.838.4


### 4.5. Discussion

Similar to extractive summarization, we can use the topn extracted keywords to form a summary, which then can be used to evaluate the quality of keywords. The first entry of Table 4 shows the performance when the keywords are extracted by TF-IDF [39], a numerical statistic method that relies on the frequency of the word. The second entry shows the performance when we determine keywords based on the source representation learned by the encoder of LCCN. As can be seen from the last entry, word selector outperforms two methods mentioned above by a large margin, indicating the importance of external knowledge brought by the BERT.Table 4
Results of different approaches to extract keywords.
ModelsROUGE-1ROUGE-2ROUGE-LTFIDF28.613.120.7Encoder of LCCN42.025.633.7Word selector46.028.236.1Given a source text which describes the criminal case, we show its summaries generated by different models in Table5. It is clear that the suspect of this case is a high school student and the victim is his baby daughter. However, the summary generated by the Transformer mistakes the high school student’s parents as victims and claims that the crime took place in the street, which is not mentioned in the source text. The summary of the CopyTransformer also makes a fundamental mistake, resulting the mismatch between the adjective “17岁 (17-year-old)” and the noun “女婴儿 (female infant)”. Compared with them, the summary of our LCCN is more faithful to the source text and contains the correct suspect and victim, i.e., “高中生 (high school student)” and “婴儿 (infant),” which are copied from the source text through only two decoder steps. With the help of word selector, our summary can further include the keyword “害怕 (fear)” to indicate the criminal motive.Table 5
Summarization examples. Summaries in the last two blocks are separated by spaces to show the output of LCCN and LCCN+word selector per step. We use keywords to denote the multicharacter words chosen by the word selector.
Source: 9月5日, 陕西咸阳双泉村垃圾站发现一名死亡女婴, 脖子上缠有绳子。近日案件告破, 令人意外的是, 婴儿的父母是17岁左右的在校高中生, 涉嫌勒死婴儿的，是孩子父亲。“当时看见孩子生下来心就慌了, 害怕孩子哭，便用绳子勒死了”。On September 5, a dead baby girl with a rope around her neck was found at the Shuangquan Village Garbage Station in Xianyang, Shaanxi Province. Recently, the case was solved. Surprisingly, the parents of the baby were high school students around 17 years old. The father of the baby was suspected of strangulating his baby. “When I saw the baby born, I was in a panic. I was afraid of a baby crying, so I strangled her with a rope.”Reference: 咸阳两高中生同居生下女婴因害怕孩子哭将其勒死。Two high school students in Xianyang lived together and gave birth to a baby girl and strangled her for fear of baby crying.Transformer: 17岁高中生当街勒死亲生父母。17-year-old high school students strangled their parents in the street.CopyTransformer: 陕西17岁女婴儿缠绳子勒死。17-year-old female infant in Shaanxi was strangled with rope.LCNN: 17岁 高中生 勒 死 婴儿。17-year-old high school student strangled a infant.LCNN+word selector: 高中生 因 害怕 勒 死 婴儿。High school student strangled a infant out of fear.Keywords: 女婴 (baby girl), 婴儿 (infant), 孩子 (baby), 勒死 (strangle), 害怕 (fear), 高中 (high school), 陕西 (Shaanxi), 绳子 (rope), 高中生 (high school students), 父亲 (father)Compared with character-based models, our LCCN uses fewer steps to output a summary, so it should be able to reduce the possibility of repetition. To prove it, we record the percentage ofn-gram duplicates for summaries generated by different models in Table 2. The results as shown in Figure 2 show that our model can indeed alleviate the repetition problem, and we also notice that the repetition rate of the LCCN+word selector is slightly higher than that of LCNN, which may be due to the smaller output space after adding the word selector.Figure 2
Percentage of the duplicates.


## 4.1. Datasets and Evaluation Metric

We conduct experiments on the Large-Scale Chinese Social Media Text Summarization Dataset (LCSTS) [7], which consists of source texts with no more than 140 characters, along with human-generated summaries. The dataset is divided into three parts; the (source, summary) pairs in PART II and PART III are scored manually from 1 to 5, with higher scores indicating more relevance between the source text and its summary. Following Hu et al. [7], after removing pairs with scores less than 3, PART I, PART II, and PART III are used as training set, verification set, and test set, respectively, with 2.4M pairs in PART I, 8K pairs in PART II, and 0.7K pairs in PART III.We choose ROUGE score [36] as our evaluation metric, which is widely used for evaluating automatically produced summaries. The metric measure the relevance between a source text and its summary based on their cooccurrence statistics. In particular, ROUGE-1 and ROUGE-2 depend on unigram and bigram overlap, respectively, while ROUGE-L relies on the longest common subsequence.


## 4.2. Experimental Setup

The character vocabulary is formed by 4000 most frequent characters in the training set. To get all potential words, we use PKUSEG [37], a toolkit for multidomain Chinese word segmentation. Specifically, there are separate segmentators for four domains, including web, news, medicine, and tourism. We use these segmentators for the source text, and if a text span is included in any of word segmentation results, we regard it as a potential word.For the lexicon-constrained copying network, we employ six attention layers of 8 heads for both encoder and decoder. Constantr in Table 2 is set to 8. We make character embedding and all hidden vectors the same dimension of 512 and set the filter size of feed-forward layers to 1024. For word selectors, we use a single-layer Bi-LSTM with a hidden size of 512.During training, we update the parameters of the lexicon-constrained copying network (LCCN) and word selector by Adam optimizer withβ1=0.9, β2=0.98, and ε=10−9. The same learning rate schedule of Vaswani et al. [18] is used to the LCCN, while a fixed learning rate of 0.0003 is set for word selector. The BERT we use in the word selector is pretrained on Chinese corpus by Wolf et al. [38] and we freeze its parameters throughout the training.During testing, we use a beam size of 10 and take the first 10 multicharacter words predicted by the word selector and all characters in the source text as keywords.


## 4.3. Baselines

(i)
RNN and RNN-Context are seq2seq baselines provided along with the LCSTS dataset by Hu et al. [7]. Both of them have GRU encoder and GRU decoder, while RNN-Context has an additional attention mechanism(ii)
COPYNET integrates copying mechanism into the seq2seq framework, trying to improve both content-based addressing and location-based addressing(iii)
Supervision with Autoencoder (superAE) uses an autoencoder trained on the summaries to provide auxiliary supervision for the internal representation of seq2seq. Moreover, adversarial learning is adopted to enhance this supervision(iv)
Global Encoding refines source representation with consideration of the global context by using a convolutional gated unit(v)
Keyword and Generated Word Attention (KGWA) exploits relevant keywords and previously generated words to learn accurate source representation and to alleviate the information loss problem(vi)
Keyword Extraction and Summary Generation (KESG) first uses a separate seq2seq model to extract keywords and then utilize keyword information to improve the quality of the summarization(vii)
Transformer and CopyTransformer are our implementations of the Transformer framework in the task of summarization. Copy mechanism is incorporated into CopyTransformer


## 4.4. Results

Table3 records the results of our LCCN model and other seq2seq models on the LCSTS dataset. To begin with, we first compare two Transformer baselines. We can see that CopyTransformer outperforms vanilla Transformer by 0.8 ROUGE-1, 0.6 ROUGE-2, and 0.3 ROUGE-L, showing the importance of copy mechanism. The gap between our LCCN and vanilla Transformer is further widened to 1.8 ROUGE-1, 2.1 ROUGE-2, and 2.5 ROUGE-L, which asserts the superiority of lexicon-constrained copying over character-based copying. Compared to other latest models, our LCCN can achieve state-of-the-art performance in terms of ROUGE-1 and ROUGE-2 and is second only to the KGWA in terms of ROUGE-L. When also using keyword information as the KGWA does, LCCN+word selector further improves the performance and overtakes the KGWA by 0.2 ROUGE-L. We also conduct an ablation study by removing the word-enhanced beam search in LCCN, denoted by w/o word-enhanced beam search in Table 3. It shows that word-enhanced beam search can boost the performance of 1.7 ROUGE-1, 1.0 ROUGE-2, and 0.9 ROUGE-L.Table 3
Results of different models. We use† to indicate that the model utilizes keyword information.
ModelsROUGE-1ROUGE-2ROUGE-LRNN [7]21.58.918.6RNN-Content [7]29.917.427.2COPYNET [13]34.421.631.3superAE [11]39.226.036.2Global Encoding [10]39.426.936.5KESG† [31]39.428.435.3KGWA† [30]40.928.338.2Transformer38.927.435.5CopyTransformer39.728.035.8LCCN41.729.538.0w/o word-enhanced beam search40.028.537.1LCCN+word selector†42.329.838.4


## 4.5. Discussion

Similar to extractive summarization, we can use the topn extracted keywords to form a summary, which then can be used to evaluate the quality of keywords. The first entry of Table 4 shows the performance when the keywords are extracted by TF-IDF [39], a numerical statistic method that relies on the frequency of the word. The second entry shows the performance when we determine keywords based on the source representation learned by the encoder of LCCN. As can be seen from the last entry, word selector outperforms two methods mentioned above by a large margin, indicating the importance of external knowledge brought by the BERT.Table 4
Results of different approaches to extract keywords.
ModelsROUGE-1ROUGE-2ROUGE-LTFIDF28.613.120.7Encoder of LCCN42.025.633.7Word selector46.028.236.1Given a source text which describes the criminal case, we show its summaries generated by different models in Table5. It is clear that the suspect of this case is a high school student and the victim is his baby daughter. However, the summary generated by the Transformer mistakes the high school student’s parents as victims and claims that the crime took place in the street, which is not mentioned in the source text. The summary of the CopyTransformer also makes a fundamental mistake, resulting the mismatch between the adjective “17岁 (17-year-old)” and the noun “女婴儿 (female infant)”. Compared with them, the summary of our LCCN is more faithful to the source text and contains the correct suspect and victim, i.e., “高中生 (high school student)” and “婴儿 (infant),” which are copied from the source text through only two decoder steps. With the help of word selector, our summary can further include the keyword “害怕 (fear)” to indicate the criminal motive.Table 5
Summarization examples. Summaries in the last two blocks are separated by spaces to show the output of LCCN and LCCN+word selector per step. We use keywords to denote the multicharacter words chosen by the word selector.
Source: 9月5日, 陕西咸阳双泉村垃圾站发现一名死亡女婴, 脖子上缠有绳子。近日案件告破, 令人意外的是, 婴儿的父母是17岁左右的在校高中生, 涉嫌勒死婴儿的，是孩子父亲。“当时看见孩子生下来心就慌了, 害怕孩子哭，便用绳子勒死了”。On September 5, a dead baby girl with a rope around her neck was found at the Shuangquan Village Garbage Station in Xianyang, Shaanxi Province. Recently, the case was solved. Surprisingly, the parents of the baby were high school students around 17 years old. The father of the baby was suspected of strangulating his baby. “When I saw the baby born, I was in a panic. I was afraid of a baby crying, so I strangled her with a rope.”Reference: 咸阳两高中生同居生下女婴因害怕孩子哭将其勒死。Two high school students in Xianyang lived together and gave birth to a baby girl and strangled her for fear of baby crying.Transformer: 17岁高中生当街勒死亲生父母。17-year-old high school students strangled their parents in the street.CopyTransformer: 陕西17岁女婴儿缠绳子勒死。17-year-old female infant in Shaanxi was strangled with rope.LCNN: 17岁 高中生 勒 死 婴儿。17-year-old high school student strangled a infant.LCNN+word selector: 高中生 因 害怕 勒 死 婴儿。High school student strangled a infant out of fear.Keywords: 女婴 (baby girl), 婴儿 (infant), 孩子 (baby), 勒死 (strangle), 害怕 (fear), 高中 (high school), 陕西 (Shaanxi), 绳子 (rope), 高中生 (high school students), 父亲 (father)Compared with character-based models, our LCCN uses fewer steps to output a summary, so it should be able to reduce the possibility of repetition. To prove it, we record the percentage ofn-gram duplicates for summaries generated by different models in Table 2. The results as shown in Figure 2 show that our model can indeed alleviate the repetition problem, and we also notice that the repetition rate of the LCCN+word selector is slightly higher than that of LCNN, which may be due to the smaller output space after adding the word selector.Figure 2
Percentage of the duplicates.


## 5. Conclusion

In this paper, we propose a novel lexicon-constrained copying network for Chinese summarization. Querying the multigranularity representation learned by our encoder, our decoder can copy either a character or a multicharacter word at each time step. Experiments on the LCSTS dataset show that our model is superior to the Transformer baselines and quite competitive with the latest models. With the help of keyword information provided by the word selector, it can even achieve state-of-the-art performance. In the future, we plan to apply our model to other tasks, such as comment generation, and to other languages, such as English.



---

*Source: 8703100-2022-03-12.xml*