Data

Dataset

class supar.utils.data.Dataset(transform, data, **kwargs)[source]

Dataset that is compatible with torch.utils.data.Dataset, serving as a wrapper for manipulating all data fields with the operating behaviours defined in Transform. The data fields of all the instantiated sentences can be accessed as an attribute of the dataset.

Parameters
  • transform (Transform) – An instance of Transform or its derivations. The instance holds a series of loading and processing behaviours with regard to the specific data format.

  • data (list[list] or str) – A list of instances or a filename that will be passed into transform.load().

  • kwargs (dict) – Together with data, kwargs will be passed into transform.load() to control the loading behaviour.

transform

An instance of Transform.

Type

Transform

sentences

A list of sentences loaded from the data. Each sentence includes fields obeying the data format defined in transform.

Type

list[Sentence]