Convert dataset to Parquet

#4
by albertvillanova HF staff - opened
README.md CHANGED
@@ -22,6 +22,7 @@ task_ids:
22
  paperswithcode_id: sms-spam-collection-data-set
23
  pretty_name: SMS Spam Collection Data Set
24
  dataset_info:
 
25
  features:
26
  - name: sms
27
  dtype: string
@@ -31,13 +32,18 @@ dataset_info:
31
  names:
32
  '0': ham
33
  '1': spam
34
- config_name: plain_text
35
  splits:
36
  - name: train
37
- num_bytes: 521756
38
  num_examples: 5574
39
- download_size: 203415
40
- dataset_size: 521756
 
 
 
 
 
 
41
  train-eval-index:
42
  - config: plain_text
43
  task: text-classification
 
22
  paperswithcode_id: sms-spam-collection-data-set
23
  pretty_name: SMS Spam Collection Data Set
24
  dataset_info:
25
+ config_name: plain_text
26
  features:
27
  - name: sms
28
  dtype: string
 
32
  names:
33
  '0': ham
34
  '1': spam
 
35
  splits:
36
  - name: train
37
+ num_bytes: 521752
38
  num_examples: 5574
39
+ download_size: 358869
40
+ dataset_size: 521752
41
+ configs:
42
+ - config_name: plain_text
43
+ data_files:
44
+ - split: train
45
+ path: plain_text/train-*
46
+ default: true
47
  train-eval-index:
48
  - config: plain_text
49
  task: text-classification
plain_text/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6e5518e4a49cb2de8af9c89a38b742825cdddbb55942701fc2237d4364288abd
3
+ size 358869
sms_spam.py DELETED
@@ -1,92 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
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
-
16
- # Lint as: python3
17
- """SMS Spam Collection Data Set"""
18
-
19
-
20
- import os
21
-
22
- import datasets
23
- from datasets.tasks import TextClassification
24
-
25
-
26
- _CITATION = """\
27
- @inproceedings{Almeida2011SpamFiltering,
28
- title={Contributions to the Study of SMS Spam Filtering: New Collection and Results},
29
- author={Tiago A. Almeida and Jose Maria Gomez Hidalgo and Akebo Yamakami},
30
- year={2011},
31
- booktitle = "Proceedings of the 2011 ACM Symposium on Document Engineering (DOCENG'11)",
32
- }
33
- """
34
-
35
- _DESCRIPTION = """\
36
- The SMS Spam Collection v.1 is a public set of SMS labeled messages that have been collected for mobile phone spam research.
37
- It has one collection composed by 5,574 English, real and non-enconded messages, tagged according being legitimate (ham) or spam.
38
- """
39
-
40
- _DATA_URL = "http://archive.ics.uci.edu/ml/machine-learning-databases/00228/smsspamcollection.zip"
41
-
42
-
43
- class SmsSpam(datasets.GeneratorBasedBuilder):
44
- """SMS Spam Collection Data Set"""
45
-
46
- BUILDER_CONFIGS = [
47
- datasets.BuilderConfig(
48
- name="plain_text",
49
- version=datasets.Version("1.0.0", ""),
50
- description="Plain text import of SMS Spam Collection Data Set",
51
- )
52
- ]
53
-
54
- def _info(self):
55
- return datasets.DatasetInfo(
56
- description=_DESCRIPTION,
57
- features=datasets.Features(
58
- {
59
- "sms": datasets.Value("string"),
60
- "label": datasets.features.ClassLabel(names=["ham", "spam"]),
61
- }
62
- ),
63
- supervised_keys=("sms", "label"),
64
- homepage="http://archive.ics.uci.edu/ml/datasets/SMS+Spam+Collection",
65
- citation=_CITATION,
66
- task_templates=[TextClassification(text_column="sms", label_column="label")],
67
- )
68
-
69
- def _split_generators(self, dl_manager):
70
- dl_dir = dl_manager.download_and_extract(_DATA_URL)
71
- return [
72
- datasets.SplitGenerator(
73
- name=datasets.Split.TRAIN, gen_kwargs={"filepath": os.path.join(dl_dir, "SMSSpamCollection")}
74
- ),
75
- ]
76
-
77
- def _generate_examples(self, filepath):
78
- """This function returns the examples in the raw (text) form."""
79
-
80
- with open(filepath, encoding="utf-8") as sms_file:
81
- for idx, line in enumerate(sms_file):
82
- fields = line.split("\t")
83
-
84
- if fields[0] == "ham":
85
- label = 0
86
- else:
87
- label = 1
88
-
89
- yield idx, {
90
- "sms": fields[1],
91
- "label": label,
92
- }