def METHOD_NAME(hparams):
    """
    This function prepares the datasets to be used in the brain class.
    It also defines the data processing pipeline through user-defined
    functions.
    """
    data_folder = hparams["save_folder"]
    train_data = sb.dataio.dataset.DynamicItemDataset.from_csv(
        csv_path=hparams["train_csv"], replacements={"data_root": data_folder},
    )
    valid_data = sb.dataio.dataset.DynamicItemDataset.from_csv(
        csv_path=hparams["valid_csv"], replacements={"data_root": data_folder},
    )
    test_data = sb.dataio.dataset.DynamicItemDataset.from_csv(
        csv_path=hparams["test_csv"], replacements={"data_root": data_folder},
    )
    datasets = [train_data, valid_data, test_data]
    # We get the tokenizer as we need it to encode the labels when creating
    # mini-batches.
    tokenizer = hparams["tokenizer"]
    """Define text pipeline"""
    @sb.utils.data_pipeline.takes("words")
    @sb.utils.data_pipeline.provides("words", "tokens_bos", "tokens_eos")
    def text_pipeline(words):
        yield words
        tokens_list = tokenizer.encode_as_ids(words)
        tokens_bos = torch.LongTensor([hparams["bos_index"]] + (tokens_list))
        yield tokens_bos
        tokens_eos = torch.LongTensor(tokens_list + [hparams["eos_index"]])
        yield tokens_eos
    sb.dataio.dataset.add_dynamic_item(datasets, text_pipeline)
    # 4. Set output:
    sb.dataio.dataset.set_output_keys(
        datasets, ["id", "words", "tokens_bos", "tokens_eos"],
    )
    return train_data, valid_data, test_data