    def _contraction_test(self, data: Iterable, num_test_cases: int):
        """
        Checks if the model is invariant to contractions and expansions
        (eg. What is <-> What's).
        """
        template = Perturb.perturb(data, self.contractions(), nsamples=num_test_cases)
        test = INV(
            template.data,
            name="Contractions",
            capability="Robustness",
            description="Contract or expand contractions, e.g. What is <-> What's",
        )
        self.add_test(test)
Checks if the model is invariant to contractions and expansions
(eg. What is <-> What's).
allennlp/confidence_checks/task_checklists/task_suite.py