base_augment

class BaseAugment(create_n=1, aug_n=None, aug_percent=0.1, aug_min=1, aug_max=10, vocab='vocab')[source]

Bases: object

A base class for data augmentation

Parameters
  • create_n (int) – Number of augmented sequences.

  • aug_n (int) – Number of augmented words in sequences.

  • aug_percent (int) – Percentage of augmented words in sequences.

  • aug_min (int) – Minimum number of augmented words in sequences.

  • aug_max (int) – Maximum number of augmented words in sequences.

classmethod clean(sequences)[source]

Clean input sequences

augment(sequences, num_thread=1)[source]

Apply augmentation strategy on input sequences.

Args: sequences (str or list(str)):

Input sequence or list of input sequences.

num_thread (int):

Number of threads

class FileAugment(strategies)[source]

Bases: object

File data augmentation

Parameters

strategies (List) – List of augmentation strategies.