dainis-boumber commited on
Commit
5fb457d
1 Parent(s): 31c1ef4
Files changed (1) hide show
  1. gdds.py +35 -42
gdds.py CHANGED
@@ -1,6 +1,3 @@
1
-
2
-
3
-
4
  import csv
5
  import json
6
  import os
@@ -9,59 +6,57 @@ import datasets
9
 
10
 
11
  # TODO: Add BibTeX citation
12
- # Find for instance the citation on arxiv or on the dataset repo/website
13
- _CITATION = """\
14
  TODO: Add citation here
15
  """
16
 
17
- # TODO: Add description of the dataset here
18
- # You can copy an official description
19
- _DESCRIPTION = """\
20
- This new dataset is designed to solve this great NLP task and is crafted with a lot of care.
21
  """
22
 
23
- # TODO: Add a link to an official homepage for the dataset here
24
- _HOMEPAGE = ""
25
-
26
- # TODO: Add the licence for the dataset here if you can find it
27
- _LICENSE = ""
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
 
31
- # TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
32
- class GDDS(datasets.GeneratorBasedBuilder):
33
- """TODO: Short description of my dataset."""
34
 
35
  VERSION = datasets.Version("2.1.0")
36
-
37
- # This is an example of a dataset with multiple configurations.
38
- # If you don't want/need to define several sub-sets in your dataset,
39
- # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
40
-
41
- # If you need to make complex sub-parts in the datasets with configurable options
42
- # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
43
- # BUILDER_CONFIG_CLASS = MyBuilderConfig
44
-
45
- # You will be able to load one or the other configurations in the following list with
46
- # data = datasets.load_dataset('my_dataset', 'first_domain')
47
- # data = datasets.load_dataset('my_dataset', 'second_domain')
48
  BUILDER_CONFIGS = [
49
- datasets.BuilderConfig(name="fake_news", version=VERSION, description="This part of my dataset covers a first domain"),
50
- datasets.BuilderConfig(name="job_scams", version=VERSION, description="This part of my dataset covers a second domain"),
51
- datasets.BuilderConfig(name="phishing", version=VERSION, description="This part of my dataset covers a second domain"),
52
- datasets.BuilderConfig(name="political_statements", version=VERSION, description="This part of my dataset covers a first domain"),
53
- datasets.BuilderConfig(name="product_reviews", version=VERSION, description="This part of my dataset covers a second domain"),
54
- datasets.BuilderConfig(name="sms", version=VERSION, description="This part of my dataset covers a second domain"),
55
- datasets.BuilderConfig(name="twitter_rumours", version=VERSION, description="This part of my dataset covers a first domain"),
 
56
  ]
57
 
58
  def _info(self):
59
- # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
60
  features = datasets.Features(
61
  {
62
  "text": datasets.Value("string"),
63
  "label": datasets.Value("string"),
64
- # These are the features of your dataset like images, labels ...
65
  }
66
  )
67
  return datasets.DatasetInfo(
@@ -71,7 +66,7 @@ class GDDS(datasets.GeneratorBasedBuilder):
71
  features=features, # Here we define them above because they are different between the two configurations
72
  # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
73
  # specify them. They'll be used if as_supervised=True in builder.as_dataset.
74
- # supervised_keys=("sentence", "label"),
75
  # Homepage of the dataset for documentation
76
  homepage=_HOMEPAGE,
77
  # License for the dataset if available
@@ -105,7 +100,6 @@ class GDDS(datasets.GeneratorBasedBuilder):
105
  ),
106
  datasets.SplitGenerator(
107
  name=datasets.Split.VALIDATION,
108
- # These kwargs will be passed to _generate_examples
109
  gen_kwargs={
110
  "filepath": os.path.join(data_dir['validation']),
111
  "split": "validation",
@@ -113,7 +107,6 @@ class GDDS(datasets.GeneratorBasedBuilder):
113
  ),
114
  datasets.SplitGenerator(
115
  name=datasets.Split.TEST,
116
- # These kwargs will be passed to _generate_examples
117
  gen_kwargs={
118
  "filepath": os.path.join(data_dir['test']),
119
  "split": "test"
@@ -123,7 +116,7 @@ class GDDS(datasets.GeneratorBasedBuilder):
123
 
124
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
125
  def _generate_examples(self, filepath, split):
126
- # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
127
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
128
  with open(filepath, encoding="utf-8") as f:
129
  for key, row in enumerate(f):
 
 
 
 
1
  import csv
2
  import json
3
  import os
 
6
 
7
 
8
  # TODO: Add BibTeX citation
9
+ _CITATION = """
 
10
  TODO: Add citation here
11
  """
12
 
13
+ _DESCRIPTION = """
14
+ DIFrauD -- Domain Independent Fraud Detection dataset -- is a labeled corpus containing over 95000 samples
15
+ of deceptive and truthful texts from 7 independent domains.
 
16
  """
17
 
18
+ _HOMEPAGE = "http://cs.uh.edu/~rmverma/ra2.html"
 
 
 
 
19
 
20
+ _LICENSE = """
21
+ Copyright 2023 University of Houston
22
+
23
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
24
+ (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
25
+ publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
26
+ subject to the following conditions:
27
+
28
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
29
+
30
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
31
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
33
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34
+ """
35
 
36
 
37
+ class DIFrauD(datasets.GeneratorBasedBuilder):
38
+ """Multi-Domain Deception -- a Large English Text Corpus"""
 
39
 
40
  VERSION = datasets.Version("2.1.0")
41
+
 
 
 
 
 
 
 
 
 
 
 
42
  BUILDER_CONFIGS = [
43
+ datasets.BuilderConfig(name="fake_news", version=VERSION, description="Fake News domain"),
44
+ datasets.BuilderConfig(name="job_scams", version=VERSION, description="Online Job Scams"),
45
+ datasets.BuilderConfig(name="phishing", version=VERSION, description="Email phishing attacks"),
46
+ datasets.BuilderConfig(name="political_statements", version=VERSION, description="Statements by various politicians"),
47
+ datasets.BuilderConfig(name="product_reviews", version=VERSION, description="Amazon product reviews"),
48
+ datasets.BuilderConfig(name="sms", version=VERSION, description="SMS spam and phishing attacks"),
49
+ datasets.BuilderConfig(name="twitter_rumours", version=VERSION,
50
+ description="Collection of rumours from twitter spanning several years and topics"),
51
  ]
52
 
53
  def _info(self):
54
+ # This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
55
  features = datasets.Features(
56
  {
57
  "text": datasets.Value("string"),
58
  "label": datasets.Value("string"),
59
+ # These are the features of your dataset ...
60
  }
61
  )
62
  return datasets.DatasetInfo(
 
66
  features=features, # Here we define them above because they are different between the two configurations
67
  # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
68
  # specify them. They'll be used if as_supervised=True in builder.as_dataset.
69
+ supervised_keys=("text", "label"),
70
  # Homepage of the dataset for documentation
71
  homepage=_HOMEPAGE,
72
  # License for the dataset if available
 
100
  ),
101
  datasets.SplitGenerator(
102
  name=datasets.Split.VALIDATION,
 
103
  gen_kwargs={
104
  "filepath": os.path.join(data_dir['validation']),
105
  "split": "validation",
 
107
  ),
108
  datasets.SplitGenerator(
109
  name=datasets.Split.TEST,
 
110
  gen_kwargs={
111
  "filepath": os.path.join(data_dir['test']),
112
  "split": "test"
 
116
 
117
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
118
  def _generate_examples(self, filepath, split):
119
+ # This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
120
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
121
  with open(filepath, encoding="utf-8") as f:
122
  for key, row in enumerate(f):