final fixes
Browse files- test.py +15 -0
- wiki_sentences.py +5 -3
- wiki_sentences.py.lock +0 -0
test.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from tqdm import tqdm
|
| 2 |
+
from datasets import load_dataset
|
| 3 |
+
|
| 4 |
+
dataset = load_dataset("wiki_sentences.py", split='train', streaming=True)
|
| 5 |
+
|
| 6 |
+
rows = []
|
| 7 |
+
for i, row in tqdm(enumerate(dataset)):
|
| 8 |
+
rows.append(row)
|
| 9 |
+
if i > 10:
|
| 10 |
+
break
|
| 11 |
+
|
| 12 |
+
print('DATA')
|
| 13 |
+
print('')
|
| 14 |
+
for row in rows:
|
| 15 |
+
print(row)
|
wiki_sentences.py
CHANGED
|
@@ -3,6 +3,7 @@ from __future__ import absolute_import, division, print_function
|
|
| 3 |
from typing import List
|
| 4 |
|
| 5 |
import datasets
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
DESCRIPTION = '''
|
|
@@ -38,8 +39,9 @@ class WikiSentences(datasets.GeneratorBasedBuilder):
|
|
| 38 |
|
| 39 |
def _generate_examples(self, filepath):
|
| 40 |
with open(filepath, encoding="utf-8") as txt_file:
|
| 41 |
-
|
| 42 |
-
|
| 43 |
line = line.strip()
|
| 44 |
-
if line
|
| 45 |
yield i, {"text": line}
|
|
|
|
|
|
| 3 |
from typing import List
|
| 4 |
|
| 5 |
import datasets
|
| 6 |
+
import pandas as pd
|
| 7 |
|
| 8 |
|
| 9 |
DESCRIPTION = '''
|
|
|
|
| 39 |
|
| 40 |
def _generate_examples(self, filepath):
|
| 41 |
with open(filepath, encoding="utf-8") as txt_file:
|
| 42 |
+
i = 0
|
| 43 |
+
for line in txt_file:
|
| 44 |
line = line.strip()
|
| 45 |
+
if line:
|
| 46 |
yield i, {"text": line}
|
| 47 |
+
i += 1
|
wiki_sentences.py.lock
ADDED
|
File without changes
|