docstr: Creates a DataPairCorpus for the Microsoft Research Paraphrase Corpus (MRPC) from Glue benchmark.
  
  See https://gluebenchmark.com/tasks
  MRPC includes annotated train and test sets. Dev set is sampled each time when creating this corpus.
docstr_tok: ["Creates","a","DataPairCorpus","for","the","Microsoft","Research","Paraphrase","Corpus","(","MRPC",")","from","Glue","benchmark",".","See","https",":","\/\/gluebenchmark.com\/tasks","MRPC","includes","annotated","train","and","test","sets",".","Dev","set","is","sampled","each","time","when","creating","this","corpus","."]
code: def __init__(
      self,
      label_type="paraphrase",
      base_path: Optional[Union[str, Path]] = None,
      max_tokens_per_doc=-1,
      max_chars_per_doc=-1,
      use_tokenizer=True,
      in_memory: bool = True,
      sample_missing_splits: bool = True,
  ) -> None:
      """Creates a DataPairCorpus for the Microsoft Research Paraphrase Corpus (MRPC) from Glue benchmark.
  
      See https://gluebenchmark.com/tasks
      MRPC includes annotated train and test sets. Dev set is sampled each time when creating this corpus.
      """
      base_path = (
          flair.cache_root / "datasets"
          if not base_path
          else Path(base_path)
      )
  
      dataset_name = "glue"
  
      data_folder = base_path / dataset_name
  
      data_file = data_folder / "MRPC/train.tsv"
  
      mrpc_path = (
          "https://dl.fbaipublicfiles.com/senteval/senteval_data/"
      )
  
      original_filenames = [
          "msr_paraphrase_train.txt",
          "msr_paraphrase_test.txt",
      ]
  
      # if data is not downloaded yet, download it
      if not data_file.is_file():
          for original_filename in original_filenames:
              # get test and dev sets
              cached_path(
                  f"{mrpc_path}{original_filename}",
                  Path("datasets") / dataset_name / "MRPC",
              )
  
          os.rename(
              str(data_folder / "MRPC/msr_paraphrase_train.txt"),
              str(data_folder / "MRPC/train.tsv"),
          )
          os.rename(
              str(data_folder / "MRPC/msr_paraphrase_test.txt"),
              str(data_folder / "MRPC/test.tsv"),
          )
  
      super().__init__(
          data_folder / "MRPC",
          label_type=label_type,
          columns=[3, 4, 0],
          skip_first_line=True,
          use_tokenizer=use_tokenizer,
          max_tokens_per_doc=max_tokens_per_doc,
          max_chars_per_doc=max_chars_per_doc,
          in_memory=in_memory,
          sample_missing_splits=sample_missing_splits,
      )
  
imports: import logging
  import os
  from pathlib import Path
  from typing import List, Optional, Union
  import flair
  from flair.data import Corpus, DataPair, FlairDataset, Sentence, TextPair, _iter_dataset
  from flair.datasets.base import find_train_dev_test_files
  from flair.file_utils import cached_path, unpack_file, unzip_file
label_desc: Use image node_id 1 to create a new GLUE_MRPC object from inherited base classes: DataPairCorpus with example: obj = GLUE_MRPC(label_type, base_path, max_tokens_per_doc, max_chars_per_doc, use_tokenizer, in_memory, sample_missing_splits)