Commit
·
15a04a2
0
Parent(s):
Update files from the datasets library (from 1.0.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.0.0
.gitattributes
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
dataset_infos.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"sentiment140": {"description": "Sentiment140 consists of Twitter messages with emoticons, which are used as noisy labels for\nsentiment classification. For more detailed information please refer to the paper.\n", "citation": "@article{go2009twitter,\n title={Twitter sentiment classification using distant supervision},\n author={Go, Alec and Bhayani, Richa and Huang, Lei},\n journal={CS224N project report, Stanford},\n volume={1},\n number={12},\n pages={2009},\n year={2009}\n}\n", "homepage": "http://help.sentiment140.com/home", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "date": {"dtype": "string", "id": null, "_type": "Value"}, "user": {"dtype": "string", "id": null, "_type": "Value"}, "sentiment": {"dtype": "int32", "id": null, "_type": "Value"}, "query": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "sentiment140", "config_name": "sentiment140", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 73365, "num_examples": 498, "dataset_name": "sentiment140"}, "train": {"name": "train", "num_bytes": 225742946, "num_examples": 1600000, "dataset_name": "sentiment140"}}, "download_checksums": {"http://cs.stanford.edu/people/alecmgo/trainingandtestdata.zip": {"num_bytes": 81363704, "checksum": "004a3772c8a7ff9bbfeb875880f47f0679d93fc63e5cf9cff72d54a8a6162e57"}}, "download_size": 81363704, "dataset_size": 225816311, "size_in_bytes": 307180015}}
|
dummy/sentiment140/1.0.0/dummy_data.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9df71bf3c23ae815688e22c86b35f1a8692056da15db7b6ae6b1b29ef7347705
|
| 3 |
+
size 703
|
dummy/sentiment140/1.0.0/dummy_data/testdata.manual.2009.06.14.csv
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
0,1,23-04-2010,NO_QUERY,test_user,test_message
|
dummy/sentiment140/1.0.0/dummy_data/training.1600000.processed.noemoticon.csv
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
3,1,23-04-2010,NO_QUERY,train user,train message
|
sentiment140.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import absolute_import, division, print_function
|
| 2 |
+
|
| 3 |
+
import csv
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
import datasets
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
_CITATION = """\
|
| 10 |
+
@article{go2009twitter,
|
| 11 |
+
title={Twitter sentiment classification using distant supervision},
|
| 12 |
+
author={Go, Alec and Bhayani, Richa and Huang, Lei},
|
| 13 |
+
journal={CS224N project report, Stanford},
|
| 14 |
+
volume={1},
|
| 15 |
+
number={12},
|
| 16 |
+
pages={2009},
|
| 17 |
+
year={2009}
|
| 18 |
+
}
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
+
_DESCRIPTION = """\
|
| 22 |
+
Sentiment140 consists of Twitter messages with emoticons, which are used as noisy labels for
|
| 23 |
+
sentiment classification. For more detailed information please refer to the paper.
|
| 24 |
+
"""
|
| 25 |
+
_URL = "http://help.sentiment140.com/home"
|
| 26 |
+
_DATA_URL = "http://cs.stanford.edu/people/alecmgo/trainingandtestdata.zip"
|
| 27 |
+
|
| 28 |
+
_TEST_FILE_NAME = "testdata.manual.2009.06.14.csv"
|
| 29 |
+
_TRAIN_FILE_NAME = "training.1600000.processed.noemoticon.csv"
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class Sentiment140Config(datasets.BuilderConfig):
|
| 33 |
+
|
| 34 |
+
"""BuilderConfig for Break"""
|
| 35 |
+
|
| 36 |
+
def __init__(self, data_url, **kwargs):
|
| 37 |
+
"""BuilderConfig for BlogAuthorship
|
| 38 |
+
|
| 39 |
+
Args:
|
| 40 |
+
data_url: `string`, url to the dataset (word or raw level)
|
| 41 |
+
**kwargs: keyword arguments forwarded to super.
|
| 42 |
+
"""
|
| 43 |
+
super(Sentiment140Config, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
|
| 44 |
+
self.data_url = data_url
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class Sentiment140(datasets.GeneratorBasedBuilder):
|
| 48 |
+
|
| 49 |
+
VERSION = datasets.Version("0.1.0")
|
| 50 |
+
BUILDER_CONFIGS = [
|
| 51 |
+
Sentiment140Config(
|
| 52 |
+
name="sentiment140",
|
| 53 |
+
data_url=_DATA_URL,
|
| 54 |
+
description="sentiment classification dataset. Twitter messages are classified as either 'positive'=0, 'neutral'=1 or 'negative'=2.",
|
| 55 |
+
)
|
| 56 |
+
]
|
| 57 |
+
|
| 58 |
+
def _info(self):
|
| 59 |
+
return datasets.DatasetInfo(
|
| 60 |
+
# This is the description that will appear on the datasets page.
|
| 61 |
+
description=_DESCRIPTION,
|
| 62 |
+
# datasets.features.FeatureConnectors
|
| 63 |
+
features=datasets.Features(
|
| 64 |
+
{
|
| 65 |
+
"text": datasets.Value("string"),
|
| 66 |
+
"date": datasets.Value("string"),
|
| 67 |
+
"user": datasets.Value("string"),
|
| 68 |
+
"sentiment": datasets.Value("int32"),
|
| 69 |
+
"query": datasets.Value("string"),
|
| 70 |
+
}
|
| 71 |
+
),
|
| 72 |
+
# If there's a common (input, target) tuple from the features,
|
| 73 |
+
# specify them here. They'll be used if as_supervised=True in
|
| 74 |
+
# builder.as_dataset.
|
| 75 |
+
supervised_keys=None,
|
| 76 |
+
# Homepage of the dataset for documentation
|
| 77 |
+
homepage=_URL,
|
| 78 |
+
citation=_CITATION,
|
| 79 |
+
)
|
| 80 |
+
|
| 81 |
+
def _split_generators(self, dl_manager):
|
| 82 |
+
"""Returns SplitGenerators."""
|
| 83 |
+
data_dir = dl_manager.download_and_extract(_DATA_URL)
|
| 84 |
+
|
| 85 |
+
test_csv_file = os.path.join(data_dir, _TEST_FILE_NAME)
|
| 86 |
+
train_csv_file = os.path.join(data_dir, _TRAIN_FILE_NAME)
|
| 87 |
+
|
| 88 |
+
if self.config.name == "sentiment140":
|
| 89 |
+
return [
|
| 90 |
+
datasets.SplitGenerator(
|
| 91 |
+
name=datasets.Split.TRAIN,
|
| 92 |
+
# These kwargs will be passed to _generate_examples
|
| 93 |
+
gen_kwargs={"file_path": train_csv_file},
|
| 94 |
+
),
|
| 95 |
+
datasets.SplitGenerator(
|
| 96 |
+
name=datasets.Split.TEST,
|
| 97 |
+
# These kwargs will be passed to _generate_examples
|
| 98 |
+
gen_kwargs={"file_path": test_csv_file},
|
| 99 |
+
),
|
| 100 |
+
]
|
| 101 |
+
else:
|
| 102 |
+
raise NotImplementedError("{} does not exist".format(self.config.name))
|
| 103 |
+
|
| 104 |
+
def _generate_examples(self, file_path):
|
| 105 |
+
"""Yields examples."""
|
| 106 |
+
|
| 107 |
+
with open(file_path, encoding="ISO-8859-1") as f:
|
| 108 |
+
data = csv.reader(f, delimiter=",", quotechar='"')
|
| 109 |
+
for row_id, row in enumerate(data):
|
| 110 |
+
sentiment, tweet_id, date, query, user_name, message = row
|
| 111 |
+
yield "{}_{}".format(row_id, tweet_id), {
|
| 112 |
+
"text": message,
|
| 113 |
+
"date": date,
|
| 114 |
+
"user": user_name,
|
| 115 |
+
"sentiment": int(sentiment),
|
| 116 |
+
"query": query,
|
| 117 |
+
}
|