gabrielaltay
commited on
Commit
·
dcf5eb5
1
Parent(s):
dfa3a35
Update constants.py
Browse files- constants.py +3 -45
constants.py
CHANGED
@@ -1,25 +1,16 @@
|
|
1 |
-
import importlib.resources as pkg_resources
|
2 |
import json
|
3 |
from collections import defaultdict
|
4 |
from enum import Enum
|
5 |
from types import SimpleNamespace
|
6 |
|
7 |
-
from bigbio.utils import resources
|
8 |
from bigbio.utils.license import License
|
9 |
-
|
10 |
-
entailment_features,
|
11 |
-
kb_features,
|
12 |
-
pairs_features,
|
13 |
-
qa_features,
|
14 |
-
text2text_features,
|
15 |
-
text_features,
|
16 |
-
)
|
17 |
|
18 |
BigBioValues = SimpleNamespace(NULL="<BB_NULL_STR>")
|
19 |
|
20 |
# shamelessly compied from:
|
21 |
# https://github.com/huggingface/datasets/blob/master/src/datasets/utils/metadata.py
|
22 |
-
langs_json =
|
23 |
langs_dict = {k.replace("-", "_").upper(): v for k, v in json.loads(langs_json).items()}
|
24 |
Lang = Enum("Lang", langs_dict)
|
25 |
|
@@ -50,37 +41,4 @@ class Tasks(Enum):
|
|
50 |
TRANSLATION = "TRANSL"
|
51 |
SUMMARIZATION = "SUM"
|
52 |
|
53 |
-
TEXT_CLASSIFICATION = "TXTCLASS"
|
54 |
-
|
55 |
-
|
56 |
-
TASK_TO_SCHEMA = {
|
57 |
-
Tasks.NAMED_ENTITY_RECOGNITION: "KB",
|
58 |
-
Tasks.NAMED_ENTITY_DISAMBIGUATION: "KB",
|
59 |
-
Tasks.EVENT_EXTRACTION: "KB",
|
60 |
-
Tasks.RELATION_EXTRACTION: "KB",
|
61 |
-
Tasks.COREFERENCE_RESOLUTION: "KB",
|
62 |
-
Tasks.QUESTION_ANSWERING: "QA",
|
63 |
-
Tasks.TEXTUAL_ENTAILMENT: "TE",
|
64 |
-
Tasks.SEMANTIC_SIMILARITY: "PAIRS",
|
65 |
-
Tasks.PARAPHRASING: "T2T",
|
66 |
-
Tasks.TRANSLATION: "T2T",
|
67 |
-
Tasks.SUMMARIZATION: "T2T",
|
68 |
-
Tasks.TEXT_CLASSIFICATION: "TEXT",
|
69 |
-
}
|
70 |
-
|
71 |
-
SCHEMA_TO_TASKS = defaultdict(set)
|
72 |
-
for task, schema in TASK_TO_SCHEMA.items():
|
73 |
-
SCHEMA_TO_TASKS[schema].add(task)
|
74 |
-
SCHEMA_TO_TASKS = dict(SCHEMA_TO_TASKS)
|
75 |
-
|
76 |
-
VALID_TASKS = set(TASK_TO_SCHEMA.keys())
|
77 |
-
VALID_SCHEMAS = set(TASK_TO_SCHEMA.values())
|
78 |
-
|
79 |
-
SCHEMA_TO_FEATURES = {
|
80 |
-
"KB": kb_features,
|
81 |
-
"QA": qa_features,
|
82 |
-
"TE": entailment_features,
|
83 |
-
"T2T": text2text_features,
|
84 |
-
"TEXT": text_features,
|
85 |
-
"PAIRS": pairs_features,
|
86 |
-
}
|
|
|
|
|
1 |
import json
|
2 |
from collections import defaultdict
|
3 |
from enum import Enum
|
4 |
from types import SimpleNamespace
|
5 |
|
|
|
6 |
from bigbio.utils.license import License
|
7 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
BigBioValues = SimpleNamespace(NULL="<BB_NULL_STR>")
|
10 |
|
11 |
# shamelessly compied from:
|
12 |
# https://github.com/huggingface/datasets/blob/master/src/datasets/utils/metadata.py
|
13 |
+
langs_json = json.load(open("languages.json", "r"))
|
14 |
langs_dict = {k.replace("-", "_").upper(): v for k, v in json.loads(langs_json).items()}
|
15 |
Lang = Enum("Lang", langs_dict)
|
16 |
|
|
|
41 |
TRANSLATION = "TRANSL"
|
42 |
SUMMARIZATION = "SUM"
|
43 |
|
44 |
+
TEXT_CLASSIFICATION = "TXTCLASS"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|