Sieun Park
commited on
Commit
·
91bf55c
1
Parent(s):
d507b77
Upload folder using huggingface_hub
Browse files- newstext.py +30 -0
- raw/new_format_data.json +3 -0
- raw/new_format_data_val_removedup.json +3 -0
- train/new_format_data.txt +3 -0
- val/new_format_data_val_removedup.txt +3 -0
newstext.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import datasets
|
2 |
+
import os
|
3 |
+
from datasets import DatasetBuilder, SplitGenerator, DownloadConfig, Split
|
4 |
+
|
5 |
+
from datasets import GeneratorBasedBuilder, SplitGenerator, Split
|
6 |
+
|
7 |
+
class TextDataset(GeneratorBasedBuilder):
|
8 |
+
VERSION = "1.0.0"
|
9 |
+
BUILDER_CONFIGS = [
|
10 |
+
datasets.BuilderConfig(name="text", version=VERSION, description="Text data"),
|
11 |
+
]
|
12 |
+
|
13 |
+
def _info(self):
|
14 |
+
return datasets.DatasetInfo(features=datasets.Features({'text': datasets.Value('string')}))
|
15 |
+
|
16 |
+
def _split_generators(self, dl_manager):
|
17 |
+
|
18 |
+
train_path = "./train/new_format_data.txt"
|
19 |
+
val_path = "./val/new_format_data_val_removedup.txt"
|
20 |
+
train_path = dl_manager.download_and_extract(train_path)
|
21 |
+
val_path = dl_manager.download_and_extract(val_path)
|
22 |
+
return [
|
23 |
+
SplitGenerator(name=Split.TRAIN, gen_kwargs={"filepath": train_path}),
|
24 |
+
SplitGenerator(name=Split.VALIDATION, gen_kwargs={"filepath": val_path}),
|
25 |
+
]
|
26 |
+
|
27 |
+
def _generate_examples(self, filepath):
|
28 |
+
with open(filepath, encoding="utf-8") as f:
|
29 |
+
for id_, line in enumerate(f):
|
30 |
+
yield id_, {"text": line.strip()}
|
raw/new_format_data.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cd0751481c6b1edd9446876957b1d98582d36382b2fe06b99cda4f4bc5b033f3
|
3 |
+
size 375651312
|
raw/new_format_data_val_removedup.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3df62c5678386597cb90575080214053e37edd416b571e5f76ab98f00c3f55bb
|
3 |
+
size 94686286
|
train/new_format_data.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:126a1c8861dc809811f93f8a6b8731c93434070bd55523ce7bdfdd5eeff40859
|
3 |
+
size 333287661
|
val/new_format_data_val_removedup.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d913610dfe0491222ef608be8f1efecb9a901205fa4dc936d705ecb319257597
|
3 |
+
size 48719663
|