langtest.datahandler.datasource.DataFactory#

class DataFactory(file_path: str, task: str)#

Bases: object

Data factory for creating Dataset objects.

The DataFactory class is responsible for creating instances of the correct Dataset type based on the file extension.

__init__(file_path: str, task: str) None#

Initializes DataFactory object. :param file_path: Path to the dataset. :type file_path: str :param task: Task to be evaluated. :type task: str

Methods

__init__(file_path, task)

Initializes DataFactory object.

export(data, output_path)

Exports the data to the corresponding format and saves it to 'output_path'.

load()

Loads the data for the correct Dataset type.

export(data: List[Sample], output_path: str)#

Exports the data to the corresponding format and saves it to ‘output_path’. :param data: data to export :type data: List[Sample] :param output_path: path to save the data to :type output_path: str

load() List[Sample]#

Loads the data for the correct Dataset type.

Returns:

Loaded text data.

Return type:

list[Sample]