init
Browse files
tweet_topic_multilingual.py
CHANGED
@@ -102,8 +102,8 @@ _CLASS_MAPPING = {
|
|
102 |
_URL = {}
|
103 |
# plain split
|
104 |
for lan in _LANGUAGES:
|
105 |
-
_URL[lan] = {split: f"{_ROOT_URL}/{lan}/{lan}_{split}.jsonl" for split in ["train", "test", "validation"]}
|
106 |
-
_URL["en_2022"] = {split: f"{_ROOT_URL}/en_2022/{split}.jsonl" for split in ["train", "validation"]}
|
107 |
_URL["mix"] = {
|
108 |
split: [f"{_ROOT_URL}/{lan}/{lan}_{split}.jsonl" for lan in _LANGUAGES] for split in ["train", "validation"]
|
109 |
}
|
@@ -111,7 +111,7 @@ _URL["mix"] = {
|
|
111 |
for lan in _LANGUAGES:
|
112 |
_URL.update({
|
113 |
f"{lan}_cross_validation_{n}": {
|
114 |
-
split: f"{_ROOT_URL}/{lan}/cross_validation/{lan}_{split}_{n}.jsonl"
|
115 |
for split in ["train", "test", "validation"]
|
116 |
} for n in range(5)
|
117 |
})
|
@@ -141,10 +141,8 @@ class TweetTopicMultilingual(datasets.GeneratorBasedBuilder):
|
|
141 |
splits = _URL[self.config.name].keys()
|
142 |
return [datasets.SplitGenerator(name=i, gen_kwargs={"filepath": downloaded_file[i]}) for i in splits]
|
143 |
|
144 |
-
def _generate_examples(self, filepath:
|
145 |
_key = 0
|
146 |
-
if type(filepath) is not List:
|
147 |
-
filepath = [filepath]
|
148 |
for _file in filepath:
|
149 |
logger.info("generating examples from = %s", _file)
|
150 |
with open(_file, encoding="utf-8") as f:
|
|
|
102 |
_URL = {}
|
103 |
# plain split
|
104 |
for lan in _LANGUAGES:
|
105 |
+
_URL[lan] = {split: [f"{_ROOT_URL}/{lan}/{lan}_{split}.jsonl"] for split in ["train", "test", "validation"]}
|
106 |
+
_URL["en_2022"] = {split: [f"{_ROOT_URL}/en_2022/{split}.jsonl"] for split in ["train", "validation"]}
|
107 |
_URL["mix"] = {
|
108 |
split: [f"{_ROOT_URL}/{lan}/{lan}_{split}.jsonl" for lan in _LANGUAGES] for split in ["train", "validation"]
|
109 |
}
|
|
|
111 |
for lan in _LANGUAGES:
|
112 |
_URL.update({
|
113 |
f"{lan}_cross_validation_{n}": {
|
114 |
+
split: [f"{_ROOT_URL}/{lan}/cross_validation/{lan}_{split}_{n}.jsonl"]
|
115 |
for split in ["train", "test", "validation"]
|
116 |
} for n in range(5)
|
117 |
})
|
|
|
141 |
splits = _URL[self.config.name].keys()
|
142 |
return [datasets.SplitGenerator(name=i, gen_kwargs={"filepath": downloaded_file[i]}) for i in splits]
|
143 |
|
144 |
+
def _generate_examples(self, filepath: List[str]):
|
145 |
_key = 0
|
|
|
|
|
146 |
for _file in filepath:
|
147 |
logger.info("generating examples from = %s", _file)
|
148 |
with open(_file, encoding="utf-8") as f:
|