base_augment

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

基类:object

A base class for data augmentation

参数
  • 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)[源代码]

Clean input sequences

augment(sequences, num_thread=1)[源代码]

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)[源代码]

基类:object

File data augmentation

参数

strategies (List) -- List of augmentation strategies.