All Projects → nelson-liu → flatten_gigaword

nelson-liu / flatten_gigaword

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

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to flatten gigaword

dobbi
An open-source NLP library: fast text cleaning and preprocessing
Stars: ✭ 21 (-8.7%)
Mutual labels:  preprocess
carbon-preprocess-svelte
Collection of Svelte preprocessors for the Carbon Design System
Stars: ✭ 39 (+69.57%)
Mutual labels:  preprocess
svelte-typescript
Typescript monorepo for Svelte v3 (preprocess, template, types)
Stars: ✭ 214 (+830.43%)
Mutual labels:  preprocess
Seismic-Data-Preparation
Preprocessing seismic data: download, format changing, and archiving
Stars: ✭ 15 (-34.78%)
Mutual labels:  preprocess
Entity2Topic
[NAACL2018] Entity Commonsense Representation for Neural Abstractive Summarization
Stars: ✭ 20 (-13.04%)
Mutual labels:  gigaword

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/.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].