=Paper=
{{Paper
|id=Vol-2848/HAI-GEN-Paper-4
|storemode=property
|title=Literary Style Transfer with Content Preservation
|pdfUrl=https://ceur-ws.org/Vol-2848/HAI-GEN-Paper-4.pdf
|volume=Vol-2848
|authors=Katy Ilonka Gero,Chris Kedzie,Lydia B. Chilton
|dblpUrl=https://dblp.org/rec/conf/iui/GeroKC20
}}
==Literary Style Transfer with Content Preservation==
Demo: Literary Style Transfer with Content Preservation Katy Ilonka Gero, Chris Kedzie, Lydia B. Chilton Columbia University {katy,kedzie,chilton}@cs.columbia.edu Figure 1: Mock-up of demo. Users can input their own sentence and ‘transfer’ it to an alternative literary style. ABSTRACT KEYWORDS Successful style transfer in images has led to fruitful human-AI natural language processing, human-computer interaction, writing collaborations, as both novice and expert imaginations are sparked support, style transfer, computational literature by high-fidelity and intuitive image outputs. But style transfer for text is still an open challenge. Drawing on computational studies of ACM Reference Format: literature, we present a neural encoder-decoder model that transfers Katy Ilonka Gero, Chris Kedzie, Lydia B. Chilton. 2020. Demo: Literary Style Transfer with Content Preservation. In IUI ’20 Workshops, March 17, 2020, sentences from one literary style to another. We model literary Cagliari, Italy. ACM, New York, NY, USA, 2 pages. style as a suite of low-level linguistic controls, such as frequency of pronouns, prepositions, and subordinate clause constructions. We perform style transfer by keeping the content words fixed while 1 INTRODUCTION adjusting the controls to be indicative of another style. In this demo, users are able to type in their own sentences and transfer them into The success of style transfer in image processing has sparked the one of three literary styles: philosophical, gothic horror, or science imagination of novices and experts alike. From the outputs of pro- fiction. This demo is presented as a web interface, and allows users fessional artists like Helena Sarin to popular demos like Google to transfer any sentence or paragraph into a desired style. Deep Dream, these tools have fueled human-AI collaboration. Yet we live in a deeply literate society, and write far more often than Copyright © 2020 for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). we produce images, so what about manipulations of text? All text has style, whether it be formal or informal, polite or ag- gressive, colloquial, persuasive, or even robotic. Despite the success of style transfer in image processing [3, 4], there has been limited progress in the text domain, where disentangling style from content is particularly difficult. IUI ’20 Workshops, Cagliari, Italy, Gero, Kedzie, and Chilton In this work, we turn to literary style as a test-bed for style trans- feature controls: [article: 1, pronoun: 1, punct: 2, ...] fer, and build on work from literature scholars using computational output sentence: her face had turned to me, the realization red. techniques for analysis. In particular we draw on stylometry: the In an automatic evaluation, our transferred sentences are clas- use of surface level features, often counts of function words, to sified as their target style 84% of the time. We also find that our discriminate between literary styles [6, 7]. model produces highly diverse and stylistically distinctive outputs We present a controllable neural encoder-decoder model in compared to a baseline method. Full details can be found in [5]. which these surface-level linguistic features are modelled explic- itly as decoder feature embeddings. This model takes in an input 3 USER INTERACTION sentence and target style and outputs a new sentence in the target We embed this model into a web interface, as seen in Figure 1. This style. Our demo embeds this model into a web interface that allows interface allows users to type in whatever text they would like, or users to perform style transfer on arbitrary sentences as well as select from a large set of example sentences from famous literary play with and control various aspects of the style transfer process. texts. The user must also select a desired target style. The system then automatically selects several pivot sentences, and uses these 2 MODEL DESIGN, TRAINING & EVALUATION pivot sentences to generate a new sentence in the target style. The In this section we give an overview of the model; full implementa- user can then experiment with transferring to different styles or tion and evaluation details can be found in [5]. We implement our using different input texts. Additionally, the pivot sentences expose feature-controlled language model using a neural encoder-decoder the user to part of how the model works. Users can directly modify with attention [1], with 2-layer unidirectional gated recurrent units the pivot sentences and re-generate the transfer sentence. This both (GRUs) for the encoder and decoder [2]. This model takes in a gives users some insight into how the style transfer is occurring, sequence of words and a set of feature controls which represent as well as giving them more control over the final sentence. the target style. It outputs a new sequence of words – the original Although we have discussed single sentences, this system is sentence in a new style. able to transfer any length of text by splitting it into sentences. The feature controls are a set of counts of stylistically relevant Therefore users can actually input paragraphs of text and see these sentence features. There are 17 features in total, and include fea- entire paragraphs transferred into a new style. tures such as the number of conjunctions, negation words, and helper verbs. These features represent the desired style of the out- 4 LIMITATIONS AND FUTURE WORK put sentence, and can be calculated for any sentence. By encouraging the model to preserve the content words, we do In training, the model reconstructs a sentence using only the not take advantage of replacing content words with synonyms or content words of the input sentence and the input sentence’s own more drastic paraphrasing that preserves meaning. Additionally, feature controls. We use a corpus of literary texts including philos- we found it difficult to control larger-scale syntactic structures, like ophy books, gothic horror novels, and science fiction short stories. rearranging clauses. In the future, we could address these short- For example, in training on the sentence ‘The vampires fly in comings with noising methods and specialized training objectives. space.’, the model would have an input like: This demo allows users to play with a model for the computa- content words: vampires fly space tional style transfer of text. Style is a key element of writing, and feature controls: [conj: 0, article: 1, preposition: 1, ...] future human-AI writing systems will likely find style transfer, or at least careful style consideration, to be an important functionality. And the desired output would be the original sentence: These writing systems may help users revise existing writing to desired output: The vampires fly in space. better match the desired style, or may use style transfer as a way With a trained model, we transfer arbitrary content words to a to challenge users to consider their stylistic choices. new style without parallel data by setting the feature controls to be indicative of the target style. The new feature controls can be found REFERENCES in a variety of ways; a baseline method may be to select controls [1] Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2014. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473 that represent the average features of a given corpus. However, the (2014). discrete nature of this task, and the variety of ways style is surfaced [2] Kyunghyun Cho, Bart van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, across the thousands or millions of sentences in a corpus, makes Fethi Bougares, Holger Schwenk, and Yoshua Bengio. 2014. Learning Phrase Representations using RNN Encoder–Decoder for Statistical Machine Translation. averaging less useful that may otherwise be supposed. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Instead we use a ‘pivot sentence’, which is a sentence in the target Processing (EMNLP). 1724–1734. [3] Leon A Gatys, Alexander S Ecker, and Matthias Bethge. 2015. A neural algorithm style with a similar length and parts of speech. We calculate the of artistic style. arXiv preprint arXiv:1508.06576 (2015). desired feature controls using this sentence. This method also allows [4] Leon A. Gatys, Alexander S. Ecker, and Matthias Bethge. 2016. Image Style Transfer us to increase the diversity of transferred sentences by changing Using Convolutional Neural Networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR). the pivot sentence selected, and allows an easy-to-understand entry [5] Katy Gero, Chris Kedzie, Jonathan Reeve, and Lydia Chilton. 2019. Low-Level point for a user interested in exploring abilities of our model. Linguistic Controls for Style Transfer and Content Preservation. arXiv preprint Here’s an example of how style transfer would be performed on arXiv:1911.03385 (2019). [6] Frederick Mosteller and David L. Wallace. 2007. Inference and Disputed Authorship: ‘Her face turned beet red.’ with the target style ‘gothic horror’: The Federalist. Center for the Study of Language and Information. [7] Jonathan Reeve. 2019. On Early Style: a Stylochronometric Critique of Late Style content words: face turned beet red in Literature. Under Review at Digital Scholarship in the Humanities (2019). pivot sentence: the madam had become cold, her look dark.