mirror of
https://github.com/QData/TextAttack.git
synced 2021-10-13 00:05:06 +03:00
14 lines
361 B
Python
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)
|