textflint.generation_layer.transformation.UT.contraction¶
contract or extend sentence by common abbreviations¶
-
class
textflint.generation_layer.transformation.UT.contraction.Contraction(**kwargs)[source]¶ Bases:
textflint.generation_layer.transformation.transformation.TransformationTransforms input by common abbreviations.
Each sample generate one transformed sample at most.
Example:
"we're playing ping pang ball, you are so lazy. She's so beautiful!" >> "we are playing ping pang ball, you're so lazy. She is so beautiful!"
-
class
textflint.generation_layer.transformation.UT.contraction.Transformation(**kwargs)[source]¶ Bases:
abc.ABCAn abstract class for transforming a sequence of text to produce a list of potential adversarial example.
-
processor= <textflint.common.preprocess.en_processor.EnProcessor object>¶
-
transform(sample, n=1, field='x', **kwargs)[source]¶ Transform data sample to a list of Sample.
- Parameters
sample (Sample) – Data sample for augmentation.
n (int) – Max number of unique augmented output, default is 5.
field (str|list) – Indicate which fields to apply transformations.
**kwargs (dict) –
other auxiliary params.
- Returns
list of Sample
-