Skip to main content

classy.data.data_drivers

Functions

get_data_driver

def get_data_driver(
    task: str,
    extension: str,
) ‑> DataDriver

Classes

ClassySample

class ClassySample()

Subclasses (5)

get_additional_attributes

def get_additional_attributes(
    self,
) ‑> Dict[Any, Any]

pretty_print

def pretty_print(
    self,
) ‑> str

DataDriver

class DataDriver()

Subclasses (5)

dataset_exists_at_path

def dataset_exists_at_path(
    self,
    path: str,
) ‑> bool

read

def read(
    self,
    lines: Iterator[str],
) ‑> Iterator[ClassySample]

read_from_path

def read_from_path(
    self,
    path: str,
) ‑> Iterator[ClassySample]

save

def save(
    self,
    samples: Iterator[ClassySample],
    path: str,
    use_predicted_annotation: bool = False,
)

from_task_and_extension

@classmethod
def from_task_and_extension(
    task,
    extension,
)

register

@classmethod
def register(
    task: str,
    extension: str,
)

GenerationDataDriver

class GenerationDataDriver()

Subclasses (2)

read

def read(
    self,
    lines: Iterator[str],
) ‑> Iterator[GenerationSample]

save

def save(
    self,
    samples: Iterator[GenerationSample],
    path: str,
    use_predicted_annotation: bool = False,
)

GenerationSample

class GenerationSample()

__init__

def __init__(
    source_sequence: str,
    source_language: Optional[str] = None,
    target_sequence: Optional[str] = None,
    target_language: Optional[str] = None,
    **kwargs,
)

pretty_print

def pretty_print(
    self,
) ‑> str

JSONLGenerationDataDriver

class JSONLGenerationDataDriver()

read

def read(
    self,
    lines: Iterator[str],
) ‑> Iterator[GenerationSample]

save

def save(
    self,
    samples: Iterator[GenerationSample],
    path: str,
    use_predicted_annotation: bool = False,
)

JSONLQADataDriver

class JSONLQADataDriver()

read

def read(
    self,
    lines: Iterator[str],
) ‑> Iterator[QASample]

save

def save(
    self,
    samples: Iterator[QASample],
    path: str,
    use_predicted_annotation: bool = False,
)

JSONLSentencePairDataDriver

class JSONLSentencePairDataDriver()

read

def read(
    self,
    lines: Iterator[str],
) ‑> Iterator[SentencePairSample]

save

def save(
    self,
    samples: Iterator[SentencePairSample],
    path: str,
    use_predicted_annotation: bool = False,
)

JSONLSequenceDataDriver

class JSONLSequenceDataDriver()

read

def read(
    self,
    lines: Iterator[str],
) ‑> Iterator[SequenceSample]

save

def save(
    self,
    samples: Iterator[SequenceSample],
    path: str,
    use_predicted_annotation: bool = False,
)

JSONLTokensDataDriver

class JSONLTokensDataDriver()

read

def read(
    self,
    lines: Iterator[str],
) ‑> Iterator[TokensSample]

save

def save(
    self,
    samples: Iterator[TokensSample],
    path: str,
    use_predicted_annotation: bool = False,
)

QADataDriver

class QADataDriver()

Subclasses (2)

read

def read(
    self,
    lines: Iterator[str],
) ‑> Iterator[QASample]

save

def save(
    self,
    samples: Iterator[QASample],
    path: str,
    use_predicted_annotation: bool = False,
)

QASample

class QASample()

__init__

def __init__(
    context: str,
    question: str,
    answer_start: Optional[int] = None,
    answer_end: Optional[int] = None,
    **kwargs,
)

pretty_print

def pretty_print(
    self,
) ‑> str

SentencePairDataDriver

class SentencePairDataDriver()

Subclasses (2)

read

def read(
    self,
    lines: Iterator[str],
) ‑> Iterator[SentencePairSample]

save

def save(
    self,
    samples: Iterator[SentencePairSample],
    path: str,
    use_predicted_annotation: bool = False,
)

SentencePairSample

class SentencePairSample()

__init__

def __init__(
    sentence1: str,
    sentence2: str,
    label: Optional[str] = None,
    **kwargs,
)

pretty_print

def pretty_print(
    self,
) ‑> str

SequenceDataDriver

class SequenceDataDriver()

Subclasses (2)

read

def read(
    self,
    lines: Iterator[str],
) ‑> Iterator[SequenceSample]

save

def save(
    self,
    samples: Iterator[SequenceSample],
    path: str,
    use_predicted_annotation: bool = False,
)

SequenceSample

class SequenceSample()

__init__

def __init__(
    sequence: str,
    label: Optional[str] = None,
    **kwargs,
)

pretty_print

def pretty_print(
    self,
) ‑> str

TSVGenerationDataDriver

class TSVGenerationDataDriver()

read

def read(
    self,
    lines: Iterator[str],
) ‑> Iterator[GenerationSample]

save

def save(
    self,
    samples: Iterator[GenerationSample],
    path: str,
    use_predicted_annotation: bool = False,
)

TSVQADataDriver

class TSVQADataDriver()

read

def read(
    self,
    lines: Iterator[str],
) ‑> Iterator[QASample]

save

def save(
    self,
    samples: Iterator[QASample],
    path: str,
    use_predicted_annotation: bool = False,
)

TSVSentencePairDataDriver

class TSVSentencePairDataDriver()

read

def read(
    self,
    lines: Iterator[str],
) ‑> Iterator[SentencePairSample]

save

def save(
    self,
    samples: Iterator[SentencePairSample],
    path: str,
    use_predicted_annotation: bool = False,
)

TSVSequenceDataDriver

class TSVSequenceDataDriver()

read

def read(
    self,
    lines: Iterator[str],
) ‑> Iterator[SequenceSample]

save

def save(
    self,
    samples: Iterator[SequenceSample],
    path: str,
    use_predicted_annotation: bool = False,
)

TSVTokensDataDriver

class TSVTokensDataDriver()

read

def read(
    self,
    lines: Iterator[str],
) ‑> Iterator[TokensSample]

save

def save(
    self,
    samples: Iterator[TokensSample],
    path: str,
    use_predicted_annotation: bool = False,
)

TokensDataDriver

class TokensDataDriver()

Subclasses (2)

read

def read(
    self,
    lines: Iterator[str],
) ‑> Iterator[TokensSample]

save

def save(
    self,
    samples: Iterator[TokensSample],
    path: str,
    use_predicted_annotation: bool = False,
)

TokensSample

class TokensSample()

__init__

def __init__(
    tokens: List[str],
    labels: Optional[List[str]] = None,
    target: Optional[List[int]] = None,
    **kwargs,
)

pretty_print

def pretty_print(
    self,
) ‑> str