Datasets:
parquet-converter
commited on
Commit
•
fce95e7
1
Parent(s):
f7d39d7
Update parquet files
Browse files
README.md
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
---
|
|
|
|
|
|
|
|
default/sentiment_digikala_snappfood-test.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5e3afae7dbe40bd49baf4966ca08e596af34a8a5340e557e9049f3243fb72aac
|
3 |
+
size 266140
|
default/sentiment_digikala_snappfood-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3b12d86af0b6dca16a409fdb0b18cacdf696ac7d081c1419e66cec0e0f6fae30
|
3 |
+
size 3437378
|
sentiment_digikala_snappfood.py
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
import csv
|
2 |
-
import datasets
|
3 |
-
from datasets.tasks import TextClassification
|
4 |
-
|
5 |
-
|
6 |
-
_DESCRIPTION = """\
|
7 |
-
Sentiment analysis dataset extracted and labeled from Digikala and Snapp Food comments
|
8 |
-
"""
|
9 |
-
|
10 |
-
_DOWNLOAD_URLS = {
|
11 |
-
|
12 |
-
"train": "https://huggingface.co/datasets/hezar-ai/sentiment_digikala_snappfood/raw/main/sentiment_digikala_snappfood_train.csv",
|
13 |
-
"test": "https://huggingface.co/datasets/hezar-ai/sentiment_digikala_snappfood/raw/main/sentiment_digikala_snappfood_test.csv"
|
14 |
-
}
|
15 |
-
|
16 |
-
|
17 |
-
class SentimentDigikalaSnappfood(datasets.GeneratorBasedBuilder):
|
18 |
-
"""Sentiment analysis on Digikala/SnappFood comments"""
|
19 |
-
|
20 |
-
def _info(self):
|
21 |
-
return datasets.DatasetInfo(
|
22 |
-
description=_DESCRIPTION,
|
23 |
-
features=datasets.Features(
|
24 |
-
{"text": datasets.Value("string"), "label": datasets.features.ClassLabel(names=["negative", "positive", "neutral"])}
|
25 |
-
),
|
26 |
-
supervised_keys=None,
|
27 |
-
homepage="https://huggingface.co/datasets/hezar-ai/sentiment_digikala_snappfood",
|
28 |
-
task_templates=[TextClassification(text_column="text", label_column="label")],
|
29 |
-
)
|
30 |
-
|
31 |
-
def _split_generators(self, dl_manager):
|
32 |
-
train_path = dl_manager.download_and_extract(_DOWNLOAD_URLS["train"])
|
33 |
-
test_path = dl_manager.download_and_extract(_DOWNLOAD_URLS["test"])
|
34 |
-
return [
|
35 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
|
36 |
-
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}),
|
37 |
-
]
|
38 |
-
|
39 |
-
def _generate_examples(self, filepath):
|
40 |
-
"""Generate examples."""
|
41 |
-
label_mapping = {"negative": 0, "positive": 1, "neutral": 2}
|
42 |
-
with open(filepath, encoding="utf-8") as csv_file:
|
43 |
-
csv_reader = csv.reader(
|
44 |
-
csv_file, quotechar='"', skipinitialspace=True
|
45 |
-
)
|
46 |
-
for id_, row in enumerate(csv_reader):
|
47 |
-
text, label = row
|
48 |
-
label = label_mapping[label]
|
49 |
-
yield id_, {"text": text, "label": label}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sentiment_digikala_snappfood_test.csv
DELETED
The diff for this file is too large to render.
See raw diff
|
|
sentiment_digikala_snappfood_train.csv
DELETED
The diff for this file is too large to render.
See raw diff
|
|