Code Monkey home page Code Monkey logo

text-rewriting-simplification's Introduction

Neural Text Simplification Using Tensorflow

This project is an exploration of dopting tensorflow's neural machine translation model (nmt) to text simplification task. It is similar to Neural Text Simplification which is based on OpenNMT. An interactive demo is served at simpletext.xyz.

Quick Start:

  1. Clone the repository to your local machine recursively:
git clone --recursive https://github.com/captainjtx/SimpleText.git
  1. Install the python packages:
cd SimpleText
pip install -r requirements.txt
  1. Download pretrained model into local directory (./model):
mkdir model
python script/download_models.py
  1. Run inference on one of the pretrained models (seq2seq, 2-hidden layer LSTM with Attention, dropout 0.25, more info). Default input is test/complex.tt, default output is test/inference.txt :
mkdir test
cat "Science Fantasy is a genre where elements of science fiction and fantasy co-exist." > test/complext.txt
./script/test_attention.sh
less test/inference.txt

Retrain the model

Our models are trained on the Wikipedia corpus. We performed a further data cleaning on the model to focus only on sentences that are shorter than the original ones (thresholding at 80%). After that, subword tokenization (byte-pair encoding (bpe)) was performed to tackle the out-of-vocabulary problem. A nice jupyter notebook was provided to walk throught the complete preprocessing, including downloading the dataset, thresholding the sentence reduction and subword segmentation.

  1. Open jupyter notebook:
jupyter notebook
  1. Open WikNet_Explore.ipynb and run step by step.

  2. Train on the generated dataset using nmt:

./script/train_nmt_attention_bpe.sh

text-rewriting-simplification's People

Contributors

vincentwangziwen14 avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.