|
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"] |