nlpaug.flow.sometimes

Flow that apply augmentation randomly.

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

Bases: nlpaug.flow.pipeline.Pipeline

Flow that apply augmenters randomly.

Parameters:
  • flow (list) – list of flow or augmenter
  • 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()])