π augment_whitespace_prefix_and_suffix_task_inputΒΆ
Note
ID: augmentors.augment_whitespace_prefix_and_suffix_task_input | Type: AugmentPrefixSuffix
{
"augment_task_input": true,
"prefix_len": 5,
"prefixes": {
"": 30,
" ": 20,
"\\n": 40,
"\\t": 10
},
"remove_existing_whitespaces": true,
"suffix_len": 5,
"suffixes": {
"": 30,
" ": 20,
"\\n": 40,
"\\t": 10
},
"type": "augment_prefix_suffix"
}
Explanation about AugmentPrefixSuffixΒΆ
Augments the input by prepending and appending to it a randomly selected (typically, whitespace) patterns.
- Args:
- prefixes, suffixes (list or dict)the potential (typically, whitespace) patterns to select from.
The dictionary version allows to specify relative weights of the different patterns.
- prefix_len, suffix_len (positive int)The added prefix or suffix will be of length
prefix_len of suffix_len, respectively, repetitions of the randomly selected patterns.
- remove_existing_whitespacesallows to first 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 one of prefixes/suffixes is 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.