docstr: Corpus for tasks involving pairs of sentences or paragraphs.
  
  The data files are expected to be in column format where each line has a column
  for the first sentence/paragraph, the second sentence/paragraph and the labels, respectively. The columns must be separated by a given separator (default: '\t').
  
  :param data_folder: base folder with the task data
  :param columns: List that indicates the columns for the first sentence (first entry in the list), the second sentence (second entry) and label (last entry).
                  default = [0,1,2]
  :param train_file: the name of the train file
  :param test_file: the name of the test file, if None, dev data is sampled from train (if sample_missing_splits is true)
  :param dev_file: the name of the dev file, if None, dev data is sampled from train (if sample_missing_splits is true)
  :param use_tokenizer: Whether or not to use in-built tokenizer
  :param max_tokens_per_doc: If set, shortens sentences to this maximum number of tokens
  :param max_chars_per_doc: If set, shortens sentences to this maximum number of characters
  :param in_memory: If True, data will be saved in list of flair.data.DataPair objects, other wise we use lists with simple strings which needs less space
  :param label_type: Name of the label of the data pairs
  :param autofind_splits: If True, train/test/dev files will be automatically identified in the given data_folder
  :param sample_missing_splits: If True, a missing train/test/dev file will be sampled from the available data
  :param skip_first_line: If True, first line of data files will be ignored
  :param separator: Separator between columns in data files
  :param encoding: Encoding of data files
  
  :return: a Corpus with annotated train, dev and test data
docstr_tok: ["Corpus","for","tasks","involving","pairs","of","sentences","or","paragraphs",".","The","data","files","are","expected","to","be","in","column","format","where","each","line","has","a","column","for","the","first","sentence\/paragraph",",","the","second","sentence\/paragraph","and","the","labels",",","respectively",".","The","columns","must","be","separated","by","a","given","separator","(","default",":","'\\t","'",")",".",":","param","data_folder",":","base","folder","with","the","task","data",":","param","columns",":","List","that","indicates","the","columns","for","the","first","sentence","(","first","entry","in","the","list",")",",","the","second","sentence","(","second","entry",")","and","label","(","last","entry",")",".","default","=","[","0,1,2","]",":","param","train_file",":","the","name","of","the","train","file",":","param","test_file",":","the","name","of","the","test","file",",","if","None",",","dev","data","is","sampled","from","train","(","if","sample_missing_splits","is","true",")",":","param","dev_file",":","the","name","of","the","dev","file",",","if","None",",","dev","data","is","sampled","from","train","(","if","sample_missing_splits","is","true",")",":","param","use_tokenizer",":","Whether","or","not","to","use","in-built","tokenizer",":","param","max_tokens_per_doc",":","If","set",",","shortens","sentences","to","this","maximum","number","of","tokens",":","param","max_chars_per_doc",":","If","set",",","shortens","sentences","to","this","maximum","number","of","characters",":","param","in_memory",":","If","True",",","data","will","be","saved","in","list","of","flair.data.DataPair","objects",",","other","wise","we","use","lists","with","simple","strings","which","needs","less","space",":","param","label_type",":","Name","of","the","label","of","the","data","pairs",":","param","autofind_splits",":","If","True",",","train\/test\/dev","files","will","be","automatically","identified","in","the","given","data_folder",":","param","sample_missing_splits",":","If","True",",","a","missing","train\/test\/dev","file","will","be","sampled","from","the","available","data",":","param","skip_first_line",":","If","True",",","first","line","of","data","files","will","be","ignored",":","param","separator",":","Separator","between","columns","in","data","files",":","param","encoding",":","Encoding","of","data","files",":","return",":","a","Corpus","with","annotated","train",",","dev","and","test","data"]
code: def __init__(
      self,
      data_folder: Union[str, Path],
      columns: List[int] = [0, 1, 2],
      train_file=None,
      test_file=None,
      dev_file=None,
      use_tokenizer: bool = True,
      max_tokens_per_doc=-1,
      max_chars_per_doc=-1,
      in_memory: bool = True,
      label_type: Optional[str] = None,
      autofind_splits=True,
      sample_missing_splits: bool = True,
      skip_first_line: bool = False,
      separator: str = "\t",
      encoding: str = "utf-8",
  ) -> None:
      r"""Corpus for tasks involving pairs of sentences or paragraphs.
  
      The data files are expected to be in column format where each line has a column
      for the first sentence/paragraph, the second sentence/paragraph and the labels, respectively. The columns must be separated by a given separator (default: '\t').
  
      :param data_folder: base folder with the task data
      :param columns: List that indicates the columns for the first sentence (first entry in the list), the second sentence (second entry) and label (last entry).
                      default = [0,1,2]
      :param train_file: the name of the train file
      :param test_file: the name of the test file, if None, dev data is sampled from train (if sample_missing_splits is true)
      :param dev_file: the name of the dev file, if None, dev data is sampled from train (if sample_missing_splits is true)
      :param use_tokenizer: Whether or not to use in-built tokenizer
      :param max_tokens_per_doc: If set, shortens sentences to this maximum number of tokens
      :param max_chars_per_doc: If set, shortens sentences to this maximum number of characters
      :param in_memory: If True, data will be saved in list of flair.data.DataPair objects, other wise we use lists with simple strings which needs less space
      :param label_type: Name of the label of the data pairs
      :param autofind_splits: If True, train/test/dev files will be automatically identified in the given data_folder
      :param sample_missing_splits: If True, a missing train/test/dev file will be sampled from the available data
      :param skip_first_line: If True, first line of data files will be ignored
      :param separator: Separator between columns in data files
      :param encoding: Encoding of data files
  
      :return: a Corpus with annotated train, dev and test data
      """
      # find train, dev and test files if not specified
      dev_file, test_file, train_file = find_train_dev_test_files(
          data_folder,
          dev_file,
          test_file,
          train_file,
          autofind_splits=autofind_splits,
      )
  
      # create DataPairDataset for train, test and dev file, if they are given
  
      train = (
          DataPairDataset(
              train_file,
              columns=columns,
              use_tokenizer=use_tokenizer,
              max_tokens_per_doc=max_tokens_per_doc,
              max_chars_per_doc=max_chars_per_doc,
              in_memory=in_memory,
              label_type=label_type,
              skip_first_line=skip_first_line,
              separator=separator,
              encoding=encoding,
          )
          if train_file is not None
          else None
      )
  
      test = (
          DataPairDataset(
              test_file,
              columns=columns,
              use_tokenizer=use_tokenizer,
              max_tokens_per_doc=max_tokens_per_doc,
              max_chars_per_doc=max_chars_per_doc,
              in_memory=in_memory,
              label_type=label_type,
              skip_first_line=skip_first_line,
              separator=separator,
              encoding=encoding,
          )
          if test_file is not None
          else None
      )
  
      dev = (
          DataPairDataset(
              dev_file,
              columns=columns,
              use_tokenizer=use_tokenizer,
              max_tokens_per_doc=max_tokens_per_doc,
              max_chars_per_doc=max_chars_per_doc,
              in_memory=in_memory,
              label_type=label_type,
              skip_first_line=skip_first_line,
              separator=separator,
              encoding=encoding,
          )
          if dev_file is not None
          else None
      )
  
      super().__init__(
          train,
          dev,
          test,
          sample_missing_splits=sample_missing_splits,
          name=str(data_folder),
      )
  
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 DataPairCorpus object from inherited base classes: Corpus with example: obj = DataPairCorpus(data_folder, columns, train_file, test_file, dev_file, use_tokenizer, max_tokens_per_doc, max_chars_per_doc, in_memory, label_type, autofind_splits, sample_missing_splits, skip_first_line, separator, encoding)