update
Browse files- UTS_Text_v1.py +11 -4
UTS_Text_v1.py
CHANGED
|
@@ -14,6 +14,7 @@ _CITATION = """\
|
|
| 14 |
_BASE_URL = "https://huggingface.co/datasets/undertheseanlp/UTS_Text_v1/raw/main/data/"
|
| 15 |
TRAIN_FILE = "UTS_Text_v1.txt"
|
| 16 |
|
|
|
|
| 17 |
class UTS_Text_v1(datasets.GeneratorBasedBuilder):
|
| 18 |
def _info(self):
|
| 19 |
return datasets.DatasetInfo(
|
|
@@ -25,9 +26,9 @@ class UTS_Text_v1(datasets.GeneratorBasedBuilder):
|
|
| 25 |
),
|
| 26 |
supervised_keys=None,
|
| 27 |
homepage=None,
|
| 28 |
-
citation=_CITATION
|
| 29 |
)
|
| 30 |
-
|
| 31 |
def _split_generators(self, dl_manager):
|
| 32 |
"""Returns SplitGenerators."""
|
| 33 |
train_file = dl_manager.download(os.path.join(_BASE_URL, TRAIN_FILE))
|
|
@@ -39,11 +40,17 @@ class UTS_Text_v1(datasets.GeneratorBasedBuilder):
|
|
| 39 |
# "test": test_file,
|
| 40 |
}
|
| 41 |
splits = [
|
| 42 |
-
datasets.SplitGenerator(
|
|
|
|
|
|
|
| 43 |
# datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": data_files["dev"]}),
|
| 44 |
# datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": data_files["test"]}),
|
| 45 |
]
|
| 46 |
return splits
|
| 47 |
|
| 48 |
def _generate_examples(self, filepath):
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
_BASE_URL = "https://huggingface.co/datasets/undertheseanlp/UTS_Text_v1/raw/main/data/"
|
| 15 |
TRAIN_FILE = "UTS_Text_v1.txt"
|
| 16 |
|
| 17 |
+
|
| 18 |
class UTS_Text_v1(datasets.GeneratorBasedBuilder):
|
| 19 |
def _info(self):
|
| 20 |
return datasets.DatasetInfo(
|
|
|
|
| 26 |
),
|
| 27 |
supervised_keys=None,
|
| 28 |
homepage=None,
|
| 29 |
+
citation=_CITATION,
|
| 30 |
)
|
| 31 |
+
|
| 32 |
def _split_generators(self, dl_manager):
|
| 33 |
"""Returns SplitGenerators."""
|
| 34 |
train_file = dl_manager.download(os.path.join(_BASE_URL, TRAIN_FILE))
|
|
|
|
| 40 |
# "test": test_file,
|
| 41 |
}
|
| 42 |
splits = [
|
| 43 |
+
datasets.SplitGenerator(
|
| 44 |
+
name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_files["train"]}
|
| 45 |
+
),
|
| 46 |
# datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": data_files["dev"]}),
|
| 47 |
# datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": data_files["test"]}),
|
| 48 |
]
|
| 49 |
return splits
|
| 50 |
|
| 51 |
def _generate_examples(self, filepath):
|
| 52 |
+
with open(filepath, encoding="utf-8") as f:
|
| 53 |
+
guid = 0
|
| 54 |
+
for line in f:
|
| 55 |
+
text = line.strip()
|
| 56 |
+
yield guid, {"text": text}
|