def __init__(
        self,
        source_file,
        source=None,
        target_file=None,
        target=None,
        source_preprocessing=None,
        target_preprocessing=None,
        word_tokenize=None,
        top_n=-1,
        n_processes=-1,
    ):
        """
        Create a summarization dataset instance given the
        paths of the source file and the target file.

        Args:
            source_file (str): Full path of the file which contains a list of
                the input paragraphs with line break as seperator.
            source (list of str, optional): a list of input paragraphs.
                Defaults to None.
            target_file (str, optional): Full path of the file which contains a list of
                the summaries for the paragraphs in the source file with line break
                as seperator.
            target (list of str, optional): a list of summaries correponding to
                `source`. Defaults to None.
            source_preprocessing (list of functions): A list of preprocessing functions
                to process the paragraphs in the source file.
            target_preprocessing (list of functions): A list of preprocessing functions
                to process the summaries in the target file.
            top_n (int, optional): Number of examples to load from the input files.
                Defaults to -1, which means the entire dataset is loaded.
            n_processes (int, optional): Number of CPUs to use to process the data in
                parallel. Defaults to -1, which means all the CPUs will be used.
        """
        self._source_txt = []
        if source_file is not None and os.path.exists(source_file):
            with open(source_file, encoding="utf-8") as f:
                if top_n != -1:
                    self._source_txt = list(itertools.islice(f, top_n))
                else:
                    self._source_txt = f.readlines()
        if source:
            self._source_txt.extend(source)

        self._target_txt = []
        if target_file is not None and os.path.exists(target_file):
            with open(target_file, encoding="utf-8") as f:
                if top_n != -1:
                    self._target_txt = list(itertools.islice(f, top_n))
                else:
                    self._target_txt = f.readlines()
        if target:
            self._target_txt.extend(target)

        if len(self._target_txt) == 0:
            self._target_txt = None
        else:
            assert len(self._source_txt) == len(self._target_txt)

        result = parallel_preprocess(
            self._source_txt,
            preprocess_pipeline=source_preprocessing,
            word_tokenize=word_tokenize,
            num_pool=n_processes,
        )
        if word_tokenize:
            self._source_txt = list(
                map(lambda x: x[0], filter(lambda x: len(x[0]) > 0, result))
            )
            self._source = list(
                map(lambda x: x[1], filter(lambda x: len(x[1]) > 0, result))
            )
        else:
            self._source = list(
                map(lambda x: x, filter(lambda x: len(x) > 0, result))
            )

        if self._target_txt is not None and len(self._target_txt) > 0:
            result = parallel_preprocess(
                self._target_txt,
                preprocess_pipeline=target_preprocessing,
                word_tokenize=word_tokenize,
                num_pool=n_processes,
            )

            if word_tokenize:
                self._target_txt = list(
                    map(lambda x: x[0], filter(lambda x: len(x[0]) > 0, result))
                )
                self._target = list(
                    map(lambda x: x[1], filter(lambda x: len(x[1]) > 0, result))
                )
            else:
                self._target = list(
                    map(lambda x: x, filter(lambda x: len(x) > 0, result))
                )

        Create a summarization dataset instance given the
        paths of the source file and the target file.

        Args:
            source_file (str): Full path of the file which contains a list of
                the input paragraphs with line break as seperator.
            source (list of str, optional): a list of input paragraphs.
                Defaults to None.
            target_file (str, optional): Full path of the file which contains a list of
                the summaries for the paragraphs in the source file with line break
                as seperator.
            target (list of str, optional): a list of summaries correponding to
                `source`. Defaults to None.
            source_preprocessing (list of functions): A list of preprocessing functions
                to process the paragraphs in the source file.
            target_preprocessing (list of functions): A list of preprocessing functions
                to process the summaries in the target file.
            top_n (int, optional): Number of examples to load from the input files.
                Defaults to -1, which means the entire dataset is loaded.
            n_processes (int, optional): Number of CPUs to use to process the data in
                parallel. Defaults to -1, which means all the CPUs will be used.
        
utils_nlp/models/transformers/datasets.py