Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Sub-tasks:
fact-checking
Languages:
Japanese
Size:
10K - 100K
License:
Commit
•
126dcbe
1
Parent(s):
206149e
Delete loading script
Browse files- covid_tweets_japanese.py +0 -91
covid_tweets_japanese.py
DELETED
@@ -1,91 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
3 |
-
#
|
4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
-
# you may not use this file except in compliance with the License.
|
6 |
-
# You may obtain a copy of the License at
|
7 |
-
#
|
8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
-
#
|
10 |
-
# Unless required by applicable law or agreed to in writing, software
|
11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
# See the License for the specific language governing permissions and
|
14 |
-
# limitations under the License.
|
15 |
-
"""COVID-19 Japanese Tweets Dataset."""
|
16 |
-
|
17 |
-
|
18 |
-
import bz2
|
19 |
-
import csv
|
20 |
-
|
21 |
-
import datasets
|
22 |
-
|
23 |
-
|
24 |
-
_CITATION = """\
|
25 |
-
No paper about this dataset is published yet. \
|
26 |
-
Please cite this dataset as "鈴木 優: COVID-19 日本語 Twitter データセット (http://www.db.info.gifu-u.ac.jp/covid-19-twitter-dataset/)"
|
27 |
-
"""
|
28 |
-
|
29 |
-
_DESCRIPTION = """\
|
30 |
-
53,640 Japanese tweets with annotation if a tweet is related to COVID-19 or not. The annotation is by majority decision by 5 - 10 crowd workers. \
|
31 |
-
Target tweets include "COVID" or "コロナ". The period of the tweets is from around January 2020 to around June 2020. \
|
32 |
-
The original tweets are not contained. Please use Twitter API to get them, for example.
|
33 |
-
"""
|
34 |
-
|
35 |
-
_HOMEPAGE = "http://www.db.info.gifu-u.ac.jp/covid-19-twitter-dataset/"
|
36 |
-
|
37 |
-
_LICENSE = "CC-BY-ND 4.0"
|
38 |
-
|
39 |
-
# The HuggingFace dataset library don't host the datasets but only point to the original files
|
40 |
-
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
41 |
-
_URLs = {
|
42 |
-
"url": "http://www.db.info.gifu-u.ac.jp/data/covid19.csv.bz2",
|
43 |
-
}
|
44 |
-
|
45 |
-
|
46 |
-
class CovidTweetsJapanese(datasets.GeneratorBasedBuilder):
|
47 |
-
"""COVID-19 Japanese Tweets Dataset."""
|
48 |
-
|
49 |
-
VERSION = datasets.Version("1.1.0")
|
50 |
-
|
51 |
-
def _info(self):
|
52 |
-
features = datasets.Features(
|
53 |
-
{
|
54 |
-
"tweet_id": datasets.Value("string"),
|
55 |
-
"assessment_option_id": datasets.ClassLabel(names=["63", "64", "65", "66", "67", "68"]),
|
56 |
-
}
|
57 |
-
)
|
58 |
-
return datasets.DatasetInfo(
|
59 |
-
description=_DESCRIPTION,
|
60 |
-
features=features,
|
61 |
-
supervised_keys=None,
|
62 |
-
homepage=_HOMEPAGE,
|
63 |
-
license=_LICENSE,
|
64 |
-
citation=_CITATION,
|
65 |
-
)
|
66 |
-
|
67 |
-
def _split_generators(self, dl_manager):
|
68 |
-
"""Returns SplitGenerators."""
|
69 |
-
|
70 |
-
my_urls = _URLs["url"]
|
71 |
-
# data_url = dl_manager.download_and_extract(my_urls)
|
72 |
-
data_url = dl_manager.download(my_urls)
|
73 |
-
|
74 |
-
return [
|
75 |
-
datasets.SplitGenerator(
|
76 |
-
name=datasets.Split.TRAIN,
|
77 |
-
gen_kwargs={"filepath": data_url, "split": "train"},
|
78 |
-
),
|
79 |
-
]
|
80 |
-
|
81 |
-
def _generate_examples(self, filepath, split):
|
82 |
-
"""Yields examples."""
|
83 |
-
|
84 |
-
with bz2.open(filepath, "rt") as f:
|
85 |
-
data = csv.reader(f)
|
86 |
-
_ = next(data)
|
87 |
-
for id_, row in enumerate(data):
|
88 |
-
yield id_, {
|
89 |
-
"tweet_id": row[0],
|
90 |
-
"assessment_option_id": row[1],
|
91 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|