File size: 869 Bytes
c6ded99 a6a875e c6ded99 a6a875e c6ded99 a6a875e c6ded99 a6a875e c6ded99 a6a875e c6ded99 a6a875e c6ded99 a6a875e c6ded99 a6a875e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
from typing import NoReturn
from configs.fs import FSConfig
class ArxivConfig(FSConfig):
def __init__(self, **kwargs):
super().__init__(**kwargs)
@property
def id_key(self) -> str:
return "article_id"
@property
def source_key(self) -> str:
return "article_text"
@property
def target_key(self) -> str:
return "abstract_text"
@property
def train_file(self) -> str:
return "train.txt"
@property
def validation_file(self) -> str:
return "val.txt"
@property
def test_file(self) -> str:
return "test.txt"
def process(self, example) -> NoReturn:
example[self.source_key] = " ".join(example[self.source_key])
example[self.target_key] = " ".join(example[self.target_key]).replace("<S>", "").replace("</S>", "")
del example["labels"] |