A Swiss Army knife for making your NLP data worse on purpose
It generates synthetic training data for NLP and audio models by systematically injecting noise, from keyboard typos to transformer-based word substitutions.

What it does
nlpaug is a Python library that fabricates extra training examples for text and audio by perturbing the originals. It offers Augmenter objects that perform tasks like replacing words with BERT predictions, simulating OCR errors, masking spectrogram blocks, or inserting GPT-2-generated sentences. These can be chained into Flow pipelines that run sequentially or at random.
The interesting bit
The library treats data augmentation as a spectrum of corruption: character-level noise (KeyboardAug), embedding-driven synonym swaps (WordEmbsAug), back-translation, and even abstractive summarization. Having all of these in one place saves you from cobbling together half a dozen research repos.
Key highlights
- Character-level augmenters simulate keyboard distance errors and OCR engine mistakes.
- Word and sentence augmenters leverage BERT, RoBERTa, XLNet, GPT-2, DistilGPT-2, WordNet, and PPDB.
- Audio and spectrogram support covers pitch shifting, speed changes, time/frequency masking, and noise injection.
SequentialandSometimesFlowpipelines let you compose or randomly sample augmenters.- The README claims 70+ academic citations and compatibility with scikit-learn, PyTorch, and TensorFlow.
Caveats
- Many augmenters drag in heavy extras—
torch,transformers,librosa,gensim,nltk, or manually downloaded word vectors—and the README warns that some PPDB sources simply will not work. - The last noted release is 1.1.11 from July 2022, with recent activity limited to bug fixes like download-util repairs and label-alignment patches.
Verdict Grab it if you need to stress-test or expand a small text or speech dataset without writing boilerplate. If your data is already plentiful and clean, you probably do not need the extra dependencies.
Frequently asked
- What is makcedward/nlpaug?
- It generates synthetic training data for NLP and audio models by systematically injecting noise, from keyboard typos to transformer-based word substitutions.
- Is nlpaug open source?
- Yes — makcedward/nlpaug is open source, released under the MIT license.
- What language is nlpaug written in?
- makcedward/nlpaug is primarily written in Jupyter Notebook.
- How popular is nlpaug?
- makcedward/nlpaug has 4.7k stars on GitHub.
- Where can I find nlpaug?
- makcedward/nlpaug is on GitHub at https://github.com/makcedward/nlpaug.