Commit ·
0acf052
1
Parent(s): 7747688
Removed experiments
Browse files- data/test.csv +0 -3
- data/train.csv +0 -4
- dataset_a/test.csv +0 -4
- dataset_a/train.csv +0 -7
- dataset_b/test.csv +0 -4
- dataset_b/train.csv +0 -7
- old_tiny.py +0 -34
- preprocess.py +0 -20
data/test.csv
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
text,label
|
| 2 |
-
This is great!,1
|
| 3 |
-
Not good at all.,0
|
|
|
|
|
|
|
|
|
|
|
|
data/train.csv
DELETED
|
@@ -1,4 +0,0 @@
|
|
| 1 |
-
text,label
|
| 2 |
-
Hello World!,1
|
| 3 |
-
I love Hugging Face!,1
|
| 4 |
-
Bad weather today.,0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataset_a/test.csv
DELETED
|
@@ -1,4 +0,0 @@
|
|
| 1 |
-
id,text,label
|
| 2 |
-
6,It was a boring movie,negative
|
| 3 |
-
7,Absolutely loved the story,positive
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataset_a/train.csv
DELETED
|
@@ -1,7 +0,0 @@
|
|
| 1 |
-
id,text,label
|
| 2 |
-
1,The movie was fantastic and thrilling,positive
|
| 3 |
-
2,The plot was dull and uninteresting,negative
|
| 4 |
-
3,The visuals were stunning,positive
|
| 5 |
-
4,The characters lacked depth,negative
|
| 6 |
-
5,An amazing cinematic experience,positive
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataset_b/test.csv
DELETED
|
@@ -1,4 +0,0 @@
|
|
| 1 |
-
id,text,label
|
| 2 |
-
6,The item quality was poor,negative
|
| 3 |
-
7,Fast delivery and great packaging,positive
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataset_b/train.csv
DELETED
|
@@ -1,7 +0,0 @@
|
|
| 1 |
-
id,text,label
|
| 2 |
-
1,The product arrived early and works great,positive
|
| 3 |
-
2,It stopped working after a week,negative
|
| 4 |
-
3,Very satisfied with the purchase,positive
|
| 5 |
-
4,Customer service was unhelpful,negative
|
| 6 |
-
5,Excellent value for the price,positive
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
old_tiny.py
DELETED
|
@@ -1,34 +0,0 @@
|
|
| 1 |
-
import csv
|
| 2 |
-
import datasets
|
| 3 |
-
|
| 4 |
-
_DESCRIPTION = "A tiny text dataset example with built-in preprocessing."
|
| 5 |
-
|
| 6 |
-
class TinyTextDataset(datasets.GeneratorBasedBuilder):
|
| 7 |
-
def _info(self):
|
| 8 |
-
return datasets.DatasetInfo(
|
| 9 |
-
description=_DESCRIPTION,
|
| 10 |
-
features=datasets.Features({
|
| 11 |
-
"text": datasets.Value("string"),
|
| 12 |
-
"label": datasets.Value("int32"),
|
| 13 |
-
}),
|
| 14 |
-
)
|
| 15 |
-
|
| 16 |
-
def _split_generators(self, dl_manager):
|
| 17 |
-
urls = {
|
| 18 |
-
"train": dl_manager.download("https://huggingface.co/datasets/svinz/tiny_text_dataset/resolve/main/data/train.csv"),
|
| 19 |
-
"test": dl_manager.download("https://huggingface.co/datasets/svinz/tiny_text_dataset/resolve/main/data/test.csv"),
|
| 20 |
-
}
|
| 21 |
-
return [
|
| 22 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": urls["train"]}),
|
| 23 |
-
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": urls["test"]}),
|
| 24 |
-
]
|
| 25 |
-
|
| 26 |
-
def _generate_examples(self, filepath):
|
| 27 |
-
"""Yields examples."""
|
| 28 |
-
with open(filepath, encoding="utf-8") as f:
|
| 29 |
-
reader = csv.DictReader(f)
|
| 30 |
-
for i, row in enumerate(reader):
|
| 31 |
-
# Basic preprocessing example
|
| 32 |
-
text = row["text"].lower().strip()
|
| 33 |
-
label = int(row["label"])
|
| 34 |
-
yield i, {"text": text, "label": label}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
preprocess.py
DELETED
|
@@ -1,20 +0,0 @@
|
|
| 1 |
-
# preprocess.py
|
| 2 |
-
|
| 3 |
-
def preprocess_text(text: str) -> str:
|
| 4 |
-
"""
|
| 5 |
-
Example preprocessing function:
|
| 6 |
-
- Lowercases
|
| 7 |
-
- Strips whitespace
|
| 8 |
-
- Removes punctuation (optional)
|
| 9 |
-
"""
|
| 10 |
-
import string
|
| 11 |
-
text = text.lower().strip()
|
| 12 |
-
text = text.translate(str.maketrans("", "", string.punctuation))
|
| 13 |
-
return text
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
if __name__ == "__main__":
|
| 17 |
-
# Quick manual test
|
| 18 |
-
sample = "Hello, Hugging Face!"
|
| 19 |
-
print("Before:", sample)
|
| 20 |
-
print("After:", preprocess_text(sample))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|