πŸ“„ Augment Whitespace Prefix And Suffix Task InputΒΆ

augmentors.augment_whitespace_prefix_and_suffix_task_input

type: AugmentPrefixSuffix
prefixes: 
   : 20
  \t: 10
  \n: 40
  : 30
suffixes: 
   : 20
  \t: 10
  \n: 40
  : 30
prefix_len: 5
suffix_len: 5
remove_existing_whitespaces: True
[source]

Explanation about AugmentPrefixSuffixΒΆ

Augments the input by prepending and appending randomly selected (typically, whitespace) patterns.

Args:
prefixes, suffixes (list or dict)the potential (typically, whitespace) patterns to select from.

The dictionary version allows the specification relative weights for the different patterns.

prefix_len, suffix_len (positive int) : The added prefix or suffix will be of a certain length. remove_existing_whitespaces : Clean any existing leading and trailing whitespaces.

The strings made of repetitions of the selected pattern(s) are then prepended and/or appended to the potentially trimmed input.

If only either just prefixes or just suffixes are needed, set the other to None.

Examples:

To prepend the input with a prefix made of 4 β€˜n’-s or β€˜t’-s, employ AugmentPrefixSuffix(augment_model_input=True, prefixes=[’n’,’t’], prefix_len=4, suffixes = None) To append the input with a suffix made of 3 β€˜n’-s or β€˜t’-s, with triple β€˜n’ suffixes being preferred over triple β€˜t’, at 2:1 ratio, employ AugmentPrefixSuffix(augment_model_input=True, suffixes={’n’:2,’t’:1}, suffix_len=3, prefixes = None) which will append β€˜n’-s twice as often as β€˜t’-s.

Read more about catalog usage here.