Datasets:
tau
/

Modalities:
Text
Libraries:
Datasets
fs / configs /fs.py
yuvalkirstain's picture
update
c6ded99
raw
history blame
1.94 kB
from abc import abstractmethod
from typing import Optional, NoReturn, Union
import datasets
class FSConfig(datasets.BuilderConfig):
"""BuilderConfig for FS."""
def __init__(self, additional_features, data_url, citation, url, **kwargs):
"""BuilderConfig for FS.
Args:
additional_features: `list[string]`, list of the features that will appear in the feature dict
additionally to the self.id_key, self.source_key and self.target_key. Should not include "label".
data_url: `string`, url to download the zip file from.
citation: `string`, citation for the data set.
url: `string`, url for information about the data set.
label_classes: `list[string]`, the list of classes for the label if the
label is present as a string. Non-string labels will be cast to either
'False' or 'True'.
**kwargs: keyword arguments forwarded to super.
"""
super(FSConfig, self).__init__(version=datasets.Version("1.0.0"), **kwargs)
self.features = [self.id_key, self.source_key, self.target_key] + additional_features
if self.question_key:
self.features += [self.question_key]
self.data_url = data_url
self.citation = citation
self.url = url
@property
@abstractmethod
def id_key(self) -> str:
pass
@property
@abstractmethod
def train_file(self) -> str:
pass
@property
@abstractmethod
def validation_file(self) -> str:
pass
@property
@abstractmethod
def test_file(self) -> str:
pass
@property
@abstractmethod
def source_key(self) -> str:
pass
@property
def question_key(self) -> Union[str, None]:
return None
@property
@abstractmethod
def target_key(self) -> str:
pass
def process(self, example) -> NoReturn:
pass