INNER CODE UNIT · Python
DataProcessor
hooshvare/parsbert · scripts/utils.py:25
class DataProcessor(MainDataProcessor):
"""Processor for converting your dataset into sequence classification dataset."""
_labels = []
def get_example_from_tensor_dict(self, tensor_dict):
"""Gets an example from a dict with tensors."""
return InputExample(
tensor_dict["idx"].numpy(),
tensor_dict["sentence"].numpy().decode("utf-8"),
None,
str(tensor_dict["label"].numpy()),
)
def get_train_examples(self, data_dir):
"""Gets a collection of :class:`InputExample` for the train set."""
return self._create_examples(self._read_tsv(os.path.join(data_dir, "train.tsv")), "train")
def get_dev_examples(self, data_dir):