forked from GEM-benchmark/NL-Augmenter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TaggingOperation.py
29 lines (21 loc) Β· 894 Bytes
/
TaggingOperation.py
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
from typing import List, Tuple
from interfaces.Operation import Operation
"""
Base Class for implementing the different input transformations a generation should be robust against.
"""
class TaggingOperation(Operation):
"""
The base class for implementing tagging ({word_i,tag_i}* --> {word_j,tag_j}*) perturbations and transformations.
"tasks" :: The tasks for which this perturbation is applicable. All the list of tasks are
given in tasks.TaskType.
"languages" :: The locales and/or languages for which this perturbation is applicable. eg. "es", "mr",
"en_IN"
"""
def generate(
self, token_sequence: List[str], tag_sequence: List[str]
) -> List[Tuple[List[str], List[str]]]:
raise NotImplementedError
def filter(
self, token_sequence: List[str], tag_sequence: List[str]
) -> bool:
raise NotImplementedError