NLP | Migration summary text style

Brief introduction

For text style migration, to give an example:

Input: Thank you

Output (Jin Yong): Thank you matter

Input: Goodbye

Output (Jin Yong): Do not over!

Input: What is your your sex?

Output (Jin Yong): I ask your name?

 

Then poured a cold:

At present study natural language generation (NLG) field is still not very practical, so hope like people to understand the sentence, and then rewrite the sentence is not realistic .

Is it possible to use the method of machine translation, do not understand the sentence can achieve the conversion of the sentence? It is also quite limited. Machine translation is required to use a large number of aligned corpus were supervised learning, no one should be specially marked this corpus.

However, in certain areas, you can get through some clever corpus of data mining method. Comments such as, for example, or automatically generated summary According to press reports, this is now the subject of a lot of people are doing. If the relationship between news and news commentary corpus also as a "style change", then the answer is still there.


Related work

Next we look at some of the text style migration work, we care about:
 
1. Text style conversion feasible?
2. What is the method used? Generation or translation?
3. Evaluation criteria?
 
Papers LIST
 
Following is a brief look at the first three:
 

1. Unpaired Sentiment-to-Sentiment Translation: A Cycled Reinforcement Learning Approach

The first piece of work [1] is very attractive from the point of view title, unpaired corresponding to cycle, it is natural to think of reconstruction. The reinforcement learning is to solve the problem during training derivation of discrete text is not available.

Although there are some problems in the past text style transfer, but because of a lack of respect to the non-stylish or semantic information "plain text" explicit reservations, is prone to lead to the following situation: When the "at The Food IS Delicious" this sentence migrating from positive to negative emotions when emotions get "the What a Bad Movie " - though emotions are transformed correctly, but the main content has also changed along . This is obviously not good.

To solve this problem, this work [1] uses two Module , a neutralization module for the extraction of non-Emotional Content , another emotionalization module is used to generate or integrate Sentiment words .

As shown above, the following neutralization module is actually implemented retained by the non-emotional content delete words Emotional . This step, the authors [1] through the use of the right to self-attention get the attention of the re-classification as a feature to automatically identify the emotional words. From the experimental results, the classification accuracy of this method can reach 90% (but sentiment classification itself is not hard, a little bit more complex models can reach 95% or higher).

The next step is emotionalization module, you can see, a two encoder and decoder. Two decoder corresponding to two categories of sentiment classification (positive or negative), and for each generation (emotionalization) reconstruction during the test and training time.

Since the text of the discrete nature, the author uses the method of RL to train both Module . RL success is heavily dependent on design awards function. In this paper [1], the authors proposed two reward: sentiment confidence and BLEU . In particular BLEU, mainly for the content perserving the author wants to solve the problem --non-emotional. The final reward function is as follows:

 

 

Spots: BLEU (Bilingual Evaluation Understudy)

among them,

BLEU value here is for a translation (a sample) for the.

example:

候选译文(Predicted):
It is a guide to action which ensures that the military always obeys the commands of the party

参考译文(Gold Standard)
1:It is a guide to action that ensures that the military will forever heed Party commands
2:It is the guiding principle which guarantees the military forces always being under the command of the Party
3:It is the practical guide for the army always to heed the directions of the party

Modified n-gram Precision计算也即Pn):

这里n取值为4,也就是从1-gram计算到4-gram。

 

首先统计候选译文里每个词出现的次数,然后统计每个词在参考译文中出现的次数,Max表示3个参考译文中的最大值,Min表示候选译文和参考译文中的最大值的最小值。 例如,词"the":

然后将每个词的Min值相加,将候选译文每个词出现的次数相加,然后两值相除即得

 

 

类似得到2-gram 3-gram 4-gram的Pn,例如"ensures that":

 

 

 

然后我们取$w_{1}=w_{2}=w_{3}=w_{4}=0.25$,也就是Uniform Weights。

得到:

 

下面计算BP(Brevity Penalty),翻译过来就是“过短惩罚”。由BP的公式可知取值范围是(0,1],候选句子越短,越接近0。

候选翻译句子长度为18,参考翻译分别为:16,18,16。
所以$c=18$(候选翻译句子长度),$r=18$(参考翻译中选取长度最接近候选翻译的作为r)

所以$BP=e^0=1$

 

整合:

 $BLEU=1⋅exp(−0.684055269517)=0.504566684006$

 BLEU的取值范围是[0,1],0最差,1最好。通过计算过程,我们可以看到,BLEU值其实也就是“改进版的n-gram”加上“过短惩罚因子”。

 

从实验结果来看,过去的工作主要都只考虑了 style transfer 的成功与否(sentiment accuracy),而没有显性地考虑 content perserving,所以确实在 BLEU 指标下表现很差。

 

但是也可以看到,这篇工作提出的方法 [1] 在大幅提高 BLEU 的情况下,ACC 也有一定损失。可以从这个结果看到,想要非常自然地融入 sentiment words 并且不破坏语义和语法,是很困难的事情。看一些直观的转换结果:

 

2. Delete, Retrieve, Generate: A Simple Approach to Sentiment and Style Transfer

第二篇论文 [2] 几乎也是一样的思路。但是在具体实现上要更直接一点。第二篇论文 [2] 在进行 style transfer 的时候,基于的是这样的假设:文本的一些属性(attribute),比如文本传达出来的情感信息等,可以体现在文本中的某些特定词汇上。通过改变这些词汇,就可能直接改变整句文本的性质属性(value)。

 

由上面的示意图可以看出,作者将那些具有指示功能的特定词称为 attribute marker,通过(主要)改变这些 marker,进行 attribute transfer。文章进一步提出了4种具体的方法来改变 marker。

这4种具体的方式也由上图很清晰地展示了出来。值得一提的是 DeleteOnly 和 DeleteAndRetrieve。在删除了具体的 marker 后,作者提出再去根据这个没有情感特定性的句子去从数据中检索出一句最相似但是 attribute 的数值相反(target attribute)的话。检索出的这句话主要用于提取新的 target attribute marker,作为“重写” RNN 的输入之一。

很明显,这样的工作可能有一定局限性,但在一些简化场景中,却是更可控的。其实验结果也印证了这点 [2]。

3. Generating Sentences by Editing Prototypes

上面两篇工作都是进行风格转换,而在进行文本改写的时候,还有一类常见的场景就是进行非情感类改写,比如扩写句子,改写语法错误等。在进行这样的工作时,其实也可以采用类似的思路。先找到一个“中立”的、“简单”的“模板”,再在这个基础上加入希望增加的信息,如情感、一些复杂修饰词等等。今天要分享的最后一篇工作 [3] 就是这样一个思路。

从上面的示意图中可以看到,修改后的句子增加了“modiocre”和“ridiculous”这两个形容词,变得更复杂了。而重中之重就是在学习 edit vector 上。可以看到,此时的 edit vector 不再是 sentiment words,而是一种 semantic operation。如果让 edit vector 作为一种隐变量,也遵循某种分布,那么同样的 edit vector 应该符合同一种 edit operation,并且对于句子的改写是一种微小的可控的操作。

基于这样的假设和期望,作者用 VAE 来建模 z,目标函数如下:

关键就是如何保证学到好的 p 和 q。这篇论文使用的方式和过去很多 VAE 的文本应用都不太一样,有兴趣的同学请一定去查阅原文。值得一提的是,这篇工作中的 edit vector z 是直接拼接在给 decoder 的每一个时刻的输入上的,并没有额外的 gate 或者 transform。这也是和上面两篇工作的区别之一。

最后从结果来看,作者提出的方法确实能更自然地改写句子。这点从 case studies 还有句子的平滑度方面可以看出:

 
 
目前的方法大概就是深度学习在外加使用policy gradient的方法,对于文本的生成的损失函数只论词的生成概率,可添加语言规则的损失项,类似词性,情感等之类,可以提升,而后在beam search阶段也可添加语言规则,而不是以只关注概率。
另则,现在的文本风格迁移在人类的角度来看过于easy,离我们想象中的文本风格迁移还有很大一段距离。

Guess you like

Origin www.cnblogs.com/shona/p/12176501.html