Datasets:
Tasks:
Text Classification
Formats:
json
Languages:
English
Size:
1K - 10K
Tags:
sentiment-analysis
License:
gak97
commited on
Commit
·
85816e1
1
Parent(s):
5524b68
code changes
Browse files- BESSTIE.py +7 -7
BESSTIE.py
CHANGED
@@ -38,9 +38,9 @@ class BESSTIEConfig(datasets.GeneratorBasedBuilder):
|
|
38 |
description=_DESCRIPTION,
|
39 |
features=datasets.Features(
|
40 |
{
|
41 |
-
"id": datasets.Value("
|
42 |
"text": datasets.Value("string"),
|
43 |
-
"sentiment_label": datasets.Value("
|
44 |
}
|
45 |
),
|
46 |
supervised_keys=None,
|
@@ -48,7 +48,7 @@ class BESSTIEConfig(datasets.GeneratorBasedBuilder):
|
|
48 |
citation=_CITATION,
|
49 |
)
|
50 |
|
51 |
-
_URL = "https://huggingface.co/datasets/surrey-nlp/BESSTIE-google-sentiment-au/
|
52 |
_URLS = {
|
53 |
"train": _URL + "google-sentiment-au-train.jsonl",
|
54 |
"dev": _URL + "google-sentiment-au-valid.jsonl",
|
@@ -69,11 +69,11 @@ class BESSTIEConfig(datasets.GeneratorBasedBuilder):
|
|
69 |
"""This function returns the examples in the raw (text) form."""
|
70 |
logger.info("generating examples from = %s", filepath)
|
71 |
with open(filepath) as f:
|
72 |
-
|
73 |
-
|
74 |
id_ = int(object['id'])
|
75 |
yield id_, {
|
76 |
-
"id":
|
77 |
"text": object['text'],
|
78 |
-
"sentiment_label": object['sentiment_label'],
|
79 |
}
|
|
|
38 |
description=_DESCRIPTION,
|
39 |
features=datasets.Features(
|
40 |
{
|
41 |
+
"id": datasets.Value("int32"),
|
42 |
"text": datasets.Value("string"),
|
43 |
+
"sentiment_label": datasets.Value("int32"),
|
44 |
}
|
45 |
),
|
46 |
supervised_keys=None,
|
|
|
48 |
citation=_CITATION,
|
49 |
)
|
50 |
|
51 |
+
_URL = "https://huggingface.co/datasets/surrey-nlp/BESSTIE-google-sentiment-au/blob/main/data/"
|
52 |
_URLS = {
|
53 |
"train": _URL + "google-sentiment-au-train.jsonl",
|
54 |
"dev": _URL + "google-sentiment-au-valid.jsonl",
|
|
|
69 |
"""This function returns the examples in the raw (text) form."""
|
70 |
logger.info("generating examples from = %s", filepath)
|
71 |
with open(filepath) as f:
|
72 |
+
for line in f:
|
73 |
+
object = json.loads(line.strip())
|
74 |
id_ = int(object['id'])
|
75 |
yield id_, {
|
76 |
+
"id": id_,
|
77 |
"text": object['text'],
|
78 |
+
"sentiment_label": int(object['sentiment_label']),
|
79 |
}
|