makcedward/nlpaug

Data augmentation for NLP

What it solves

Many machine learning models require large amounts of labeled data to perform well, but creating this data manually is time-consuming. nlpaug provides a way to automatically generate synthetic training data by augmenting existing text, audio, and spectrogram data, which helps improve model performance and robustness without manual effort.

How it works

The library uses a system of Augmenter objects to modify data. It supports three primary modalities:

  • Textual: Modifies characters (simulating keyboard or OCR errors), words (using synonyms, antonyms, or embeddings like BERT, RoBERTa, and Word2Vec), and sentences (using GPT-2 or XLNet).
  • Audio: Applies signal processing techniques such as adjusting pitch, speed, volume, and injecting noise.
  • Spectrogram: Applies masking (time and frequency) and volume adjustments to visual representations of audio.

Users can use a Flow to create pipelines that apply multiple augmentation functions sequentially or randomly.

Who it’s for

It is designed for machine learning engineers and data scientists who need to expand their training datasets for NLP, audio, or speech recognition projects.

Highlights

  • Multimodal Support: Handles text, audio, and spectrograms in one library.
  • Coded for Integration: Plug-and-play compatibility with common neural network frameworks.
  • Extensive Augmentation Methods: Includes everything from simple random swaps to advanced contextual word embeddings via Transformers.
  • Pipeline Orchestration: Ability to chain multiple augmenters together via the Flow system.

Related

  • Project
  • Project
  • Project
  • Dispatch
  • Project