Flow that apply augmentation randomly.

class nlpaug.flow.sometimes.Sometimes(flow=None, name='Sometimes_Pipeline', aug_p=0.8, verbose=0)[source]

Bases: nlpaug.flow.pipeline.Pipeline

Flow that apply augmenters randomly.

  • flow (list) – list of flow or augmenter
  • aug_p (float) – Percentage of pipeline will be executed.
  • name (str) – Name of this augmenter
>>> import nlpaug.flow as naf
>>> import nlpaug.augmenter.char as nac
>>> import nlpaug.augmenter.word as naw
>>> flow = naf.Sometimes([nac.RandomCharAug(), naw.RandomWordAug()])