# 基于连续空间修改的文本属性控制算法-四川大学
**Repository Path**: dicalab/Fine-Grained-Style-Transfer
## Basic Information
- **Project Name**: 基于连续空间修改的文本属性控制算法-四川大学
- **Description**: 基于连续空间修改的文本属性控制算法,可以对多种文本细粒度属性进行控制,如情感,长度,关键词等
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-07-05
- **Last Updated**: 2021-07-05
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Revision in Continuous Space: Unsupervised Text Style Transfer without Adversarial Learning
This repo contains the code and data of the following paper:
>**Revision in Continuous Space: Unsupervised Text Style Transfer without Adversarial Learning**, *Dayiheng Liu, Jie Fu, Yidan Zhang, Chris Pal, Jiancheng Lv*, AAAI20 [[arXiv]](https://arxiv.org/abs/1905.12304)
# Overview

We explore a novel task setting for text style transfer, in which it is required to simultaneously manipulate multiple fine-grained attributes. We propose to address it by revising the original sentences in a continuous space based on gradient-based optimization.
# Dataset
- The Yelp and Amazon of the text sentiment transfer task can be downloaded at http://bit.ly/2LHMUsl or https://worksheets.codalab.org/worksheets/0xe3eb416773ed4883bb737662b31b4948/
- The Yelp of the text gender style transfer can be downloaded at http://tts.speech.cs.cmu.edu/style_models/gender_classifier.tar
- The pre-processed dataset can be downloaded at https://drive.google.com/open?id=1OoSunDBIhAlfDpznlzoCJucv9kgz41rx
# Prerequisites
- Jupyter notebook 4.4.0
- Python 3.6
- Tensorflow 1.6.0+
- Numpy
- nltk 3.3
- kenlm 0.0.0
- Moses
# Usage
- `TextCNN.ipynb`: Pretrain a Text-CNN on the train set for predictor training.
- `TextBiLSTM.ipynb`: Pretrain a Text-BiLSTM on the whole dataset for evaluation
- `KenLM / Moses`: Pretrain a language model.
- `Text_Style_Transfer_Pipeline.ipynb`: The pipeline (training, inference, and evaluation) for text sentiment transfer and text gender style transfer.
- `Multi_Finegrained_Control.ipynb`: The pipeline (training, and inference) for multiple fine-grained attributes control.
- `Eval_Multi.ipynb`: The Evaluation of the multiple fine-grained attributes control.
# Output Samples
To make it easier for other researchers to compare our methods, we release the outputs of our methods for YELP and AMAZON.
For each dataset, we provide three kinds of outputs (content-strengthen, content-style-balanced, and style-strengthen) of our method, which can be found in `outputs/`.