vineetjohn / linguistic-style-transfer

Neural network parametrized objective to disentangle and transfer style and content in text
Apache License 2.0
138 stars 33 forks source link

Use the nearest neighbor of in the content space for sentence generation #51

Closed vineetjohn closed 6 years ago

vineetjohn commented 6 years ago

Let us say, if you want to change the sentiment of sentence x, whose hidden representations are s and c, respectively. [s for style/sentiment, c for content], then you need to find s* among all the opposite sentences which have the closest c with your sentence.

In other words, the best sentence x = argmax[ cos(c, c) ] among x has an opposite sentiment, where c is the content embedding of x. Then decode from [s; c], where s = style of x.