def METHOD_NAME(self, filename, split):
    """Reads data."""
    language = self.name
    if language is None:
        language = "all_languages"
    if language not in ALL_LANGUAGES + ["all_languages"]:
        raise ValueError(
            f"Name parameter should be specified. Can be one of {ALL_LANGUAGES + ['all_languages']}. "
        )
    if language == "all_languages":
        languages = ALL_LANGUAGES
    else:
        languages = [language]
    if split == "train":
        files = [os.path.join(filename, f"multinli.train.{lang}.tsv") for lang in languages]
        if language == "all_languages":
            with ExitStack() as stack:
                files = [stack.enter_context(open(file, "r", encoding="utf-8")) for file in files]
                readers = [csv.DictReader(file, delimiter="\t", quoting=csv.QUOTE_NONE) for file in files]
                for row_idx, rows in enumerate(zip(*readers)):
                    if not rows[0]["label"]:
                        continue
                    data = {
                        "premise": {},
                        "hypothesis": {},
                        "label": rows[0]["label"].replace("contradictory", "contradiction"),
                    }
                    for lang, row in zip(languages, rows):
                        if not row["premise"] or not row["hypo"]:
                            continue
                        data["premise"][lang] = row["premise"]
                        data["hypothesis"][lang] = row["hypo"]
                    yield data
        else:
            for idx, file in enumerate(files):
                with open(file, "r", encoding="utf-8") as f:
                    reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
                    for row_idx, row in enumerate(reader):
                        if not row["premise"] or not row["hypo"] or not row["label"]:
                            continue
                        yield {
                            "premise": row["premise"],
                            "hypothesis": row["hypo"],
                            "label": row["label"].replace("contradictory", "contradiction"),
                        }
    else:
        if language == "all_languages":
            rows_per_pair_id = collections.defaultdict(list)
            with open(filename, encoding="utf-8") as f:
                reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
                for row in reader:
                    rows_per_pair_id[row["pairID"]].append(row)
            for rows in rows_per_pair_id.values():
                if not rows[0]["gold_label"]:
                    continue
                data = {"premise": {}, "hypothesis": {}, "label": rows[0]["gold_label"]}
                for row in rows:
                    if not row["sentence1"] or not row["sentence2"]:
                        continue
                    data["premise"][row["language"]] = row["sentence1"]
                    data["hypothesis"][row["language"]] = row["sentence2"]
                yield data
        else:
            with open(filename, encoding="utf-8") as f:
                reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
                for row in reader:
                    if row["language"] == language:
                        if not row["sentence1"] or not row["sentence2"] or not row["gold_label"]:
                            continue
                        yield {
                            "premise": row["sentence1"],
                            "hypothesis": row["sentence2"],
                            "label": row["gold_label"],
                        }