Coder Social home page Coder Social logo

nelson-liu / flatten_gigaword Goto Github PK

View Code? Open in Web Editor NEW
24.0 1.0 4.0 6 KB

Dump the text of the Gigaword dataset into a single file, for use with language modeling (and other!) toolkits

License: MIT License

Shell 21.52% Python 78.48%
nlp gigaword preprocess

flatten_gigaword's Introduction

Flattening the Gigaword Datset

The scripts in this repository dump the text of the Gigaword dataset into a single file, for use with language modeling (and other!) toolkits.

See my blog post on flattening the Gigaword corpus for more information about how the code in this repo works.

Table of Contents

Installation

To run this code, you must have GNU Parallel. This can be installed on Ubuntu with:

sudo apt-get install parallel

This project was developed in Python 3.6, but should work with Python 3.x and 2.x. Please raise an issue if you find that this is not the case.

Conda will set up a virtual environment with the exact version of Python used for development along with all the dependencies needed to run the code in this package.

  1. Download and install conda.

  2. Create a conda environment with Python 3.6.

    conda create -n flat python=3.6
    
  3. Now activate the conda environment.

    source activate flat
    
  4. Install the required dependencies with pip.

    pip install -r requirements.txt
    
  5. Install the required SpaCy data pack.

    python -m spacy download en
    

Usage

flatten_one_gigaword.py takes in the path of a Gigaword data file and an output directory to write a flattened version to. The bash script at flatten_all_gigaword.sh is a thin wrapper that feeds the paths of all the Gigaword data files to flatten_one_gigaword.py and combines the final output.

flatten_all_gigaword.sh takes in three positional arguments:

  1. The path to the Gigaword directory, with all of the data files unzipped.

  2. A directory to write the flattened files to and the final combined output. It will be created if it does not exist.

  3. The number of files to process at once.

For example, you can run:

./flatten_all_gigaword.sh ./data/gigaword_eng_5/ tmp/ 24

to extract data (in parallel, processing 24 files at a time) from the Gigaword corpus at ./data/gigaword_eng_5/ and write the flattened files + combined output to tmp/.

flatten_gigaword's People

Contributors

nelson-liu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

flatten_gigaword's Issues

Could you please share your Gigaword Corpus?

Hi Nelson, great work! I am trying to train a single 5-gram LM with Gigaword Corpus, but the license is quite expensive, so I'm wondering if you can share your Gigaword Corpus with me, thanks!

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.