textflint.generation_layer.transformation.SM.overlap¶
- Generate some samples by templates
implement follow Right for the Wrong Reasons: Diagnosing Syntactic Heuristics in Natural Language Inference ACL2019 In order to generate some sample whose premise is the sequence of the hypothesis but the semantic are different.
-
class
textflint.generation_layer.transformation.SM.overlap.Overlap[source]¶ Bases:
textflint.generation_layer.transformation.transformation.Transformation- Generate some samples by templates which implement follow
Right for the Wrong Reasons: Diagnosing Syntactic Heuristics in Natural Language Inference ACL2019
In order to generate some sample whose premise is the sequence of the hypothesis but the semantic are different.
Exmaple:
{ sentence1: I hope Tom can go to school. sentence2: Tom go to school. y: 0 }
-
class
textflint.generation_layer.transformation.SM.overlap.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
-