1
0
mirror of https://github.com/QData/TextAttack.git synced 2021-10-13 00:05:06 +03:00
Files
textattack-nlp-transformer/textattack/datasets/classification/classification_dataset.py
2020-06-15 17:07:12 -04:00

14 lines
361 B
Python

from textattack.datasets import TextAttackDataset
class ClassificationDataset(TextAttackDataset):
"""
A generic class for loading classification data.
"""
def _process_example_from_file(self, raw_line):
tokens = raw_line.strip().split()
label = int(tokens[0])
text = " ".join(tokens[1:])
return (text, label)