Convert dataset to Parquet

#10
README.md CHANGED
@@ -20,7 +20,7 @@ task_ids:
20
  - sentiment-classification
21
  pretty_name: FinancialPhrasebank
22
  dataset_info:
23
- - config_name: sentences_allagree
24
  features:
25
  - name: sentence
26
  dtype: string
@@ -33,11 +33,11 @@ dataset_info:
33
  '2': positive
34
  splits:
35
  - name: train
36
- num_bytes: 303371
37
- num_examples: 2264
38
- download_size: 681890
39
- dataset_size: 303371
40
- - config_name: sentences_75agree
41
  features:
42
  - name: sentence
43
  dtype: string
@@ -50,11 +50,11 @@ dataset_info:
50
  '2': positive
51
  splits:
52
  - name: train
53
- num_bytes: 472703
54
- num_examples: 3453
55
- download_size: 681890
56
- dataset_size: 472703
57
- - config_name: sentences_66agree
58
  features:
59
  - name: sentence
60
  dtype: string
@@ -67,11 +67,11 @@ dataset_info:
67
  '2': positive
68
  splits:
69
  - name: train
70
- num_bytes: 587152
71
- num_examples: 4217
72
- download_size: 681890
73
- dataset_size: 587152
74
- - config_name: sentences_50agree
75
  features:
76
  - name: sentence
77
  dtype: string
@@ -84,12 +84,29 @@ dataset_info:
84
  '2': positive
85
  splits:
86
  - name: train
87
- num_bytes: 679240
88
- num_examples: 4846
89
- download_size: 681890
90
- dataset_size: 679240
91
  tags:
92
  - finance
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  ---
94
 
95
  # Dataset Card for financial_phrasebank
 
20
  - sentiment-classification
21
  pretty_name: FinancialPhrasebank
22
  dataset_info:
23
+ - config_name: sentences_50agree
24
  features:
25
  - name: sentence
26
  dtype: string
 
33
  '2': positive
34
  splits:
35
  - name: train
36
+ num_bytes: 679240
37
+ num_examples: 4846
38
+ download_size: 389574
39
+ dataset_size: 679240
40
+ - config_name: sentences_66agree
41
  features:
42
  - name: sentence
43
  dtype: string
 
50
  '2': positive
51
  splits:
52
  - name: train
53
+ num_bytes: 587152
54
+ num_examples: 4217
55
+ download_size: 336001
56
+ dataset_size: 587152
57
+ - config_name: sentences_75agree
58
  features:
59
  - name: sentence
60
  dtype: string
 
67
  '2': positive
68
  splits:
69
  - name: train
70
+ num_bytes: 472703
71
+ num_examples: 3453
72
+ download_size: 266540
73
+ dataset_size: 472703
74
+ - config_name: sentences_allagree
75
  features:
76
  - name: sentence
77
  dtype: string
 
84
  '2': positive
85
  splits:
86
  - name: train
87
+ num_bytes: 303371
88
+ num_examples: 2264
89
+ download_size: 168765
90
+ dataset_size: 303371
91
  tags:
92
  - finance
93
+ configs:
94
+ - config_name: sentences_50agree
95
+ data_files:
96
+ - split: train
97
+ path: sentences_50agree/train-*
98
+ - config_name: sentences_66agree
99
+ data_files:
100
+ - split: train
101
+ path: sentences_66agree/train-*
102
+ - config_name: sentences_75agree
103
+ data_files:
104
+ - split: train
105
+ path: sentences_75agree/train-*
106
+ - config_name: sentences_allagree
107
+ data_files:
108
+ - split: train
109
+ path: sentences_allagree/train-*
110
  ---
111
 
112
  # Dataset Card for financial_phrasebank
financial_phrasebank.py DELETED
@@ -1,149 +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
-
16
- """Financial Phrase Bank v1.0: Polar sentiment dataset of sentences from
17
- financial news. The dataset consists of 4840 sentences from English language
18
- financial news categorised by sentiment. The dataset is divided by agreement
19
- rate of 5-8 annotators."""
20
-
21
-
22
- import os
23
-
24
- import datasets
25
-
26
-
27
- _CITATION = """\
28
- @article{Malo2014GoodDO,
29
- title={Good debt or bad debt: Detecting semantic orientations in economic texts},
30
- author={P. Malo and A. Sinha and P. Korhonen and J. Wallenius and P. Takala},
31
- journal={Journal of the Association for Information Science and Technology},
32
- year={2014},
33
- volume={65}
34
- }
35
- """
36
-
37
- _DESCRIPTION = """\
38
- The key arguments for the low utilization of statistical techniques in
39
- financial sentiment analysis have been the difficulty of implementation for
40
- practical applications and the lack of high quality training data for building
41
- such models. Especially in the case of finance and economic texts, annotated
42
- collections are a scarce resource and many are reserved for proprietary use
43
- only. To resolve the missing training data problem, we present a collection of
44
- ∼ 5000 sentences to establish human-annotated standards for benchmarking
45
- alternative modeling techniques.
46
-
47
- The objective of the phrase level annotation task was to classify each example
48
- sentence into a positive, negative or neutral category by considering only the
49
- information explicitly available in the given sentence. Since the study is
50
- focused only on financial and economic domains, the annotators were asked to
51
- consider the sentences from the view point of an investor only; i.e. whether
52
- the news may have positive, negative or neutral influence on the stock price.
53
- As a result, sentences which have a sentiment that is not relevant from an
54
- economic or financial perspective are considered neutral.
55
-
56
- This release of the financial phrase bank covers a collection of 4840
57
- sentences. The selected collection of phrases was annotated by 16 people with
58
- adequate background knowledge on financial markets. Three of the annotators
59
- were researchers and the remaining 13 annotators were master’s students at
60
- Aalto University School of Business with majors primarily in finance,
61
- accounting, and economics.
62
-
63
- Given the large number of overlapping annotations (5 to 8 annotations per
64
- sentence), there are several ways to define a majority vote based gold
65
- standard. To provide an objective comparison, we have formed 4 alternative
66
- reference datasets based on the strength of majority agreement: all annotators
67
- agree, >=75% of annotators agree, >=66% of annotators agree and >=50% of
68
- annotators agree.
69
- """
70
-
71
- _HOMEPAGE = "https://www.kaggle.com/ankurzing/sentiment-analysis-for-financial-news"
72
-
73
- _LICENSE = "Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License"
74
-
75
- _REPO = "https://huggingface.co/datasets/financial_phrasebank/resolve/main/data"
76
- _URL = f"{_REPO}/FinancialPhraseBank-v1.0.zip"
77
-
78
-
79
- _VERSION = datasets.Version("1.0.0")
80
-
81
-
82
- class FinancialPhraseBankConfig(datasets.BuilderConfig):
83
- """BuilderConfig for FinancialPhraseBank."""
84
-
85
- def __init__(
86
- self,
87
- split,
88
- **kwargs,
89
- ):
90
- """BuilderConfig for Discovery.
91
- Args:
92
- filename_bit: `string`, the changing part of the filename.
93
- """
94
-
95
- super(FinancialPhraseBankConfig, self).__init__(name=f"sentences_{split}agree", version=_VERSION, **kwargs)
96
-
97
- self.path = os.path.join("FinancialPhraseBank-v1.0", f"Sentences_{split.title()}Agree.txt")
98
-
99
-
100
- class FinancialPhrasebank(datasets.GeneratorBasedBuilder):
101
-
102
- BUILDER_CONFIGS = [
103
- FinancialPhraseBankConfig(
104
- split="all",
105
- description="Sentences where all annotators agreed",
106
- ),
107
- FinancialPhraseBankConfig(split="75", description="Sentences where at least 75% of annotators agreed"),
108
- FinancialPhraseBankConfig(split="66", description="Sentences where at least 66% of annotators agreed"),
109
- FinancialPhraseBankConfig(split="50", description="Sentences where at least 50% of annotators agreed"),
110
- ]
111
-
112
- def _info(self):
113
- return datasets.DatasetInfo(
114
- description=_DESCRIPTION,
115
- features=datasets.Features(
116
- {
117
- "sentence": datasets.Value("string"),
118
- "label": datasets.features.ClassLabel(
119
- names=[
120
- "negative",
121
- "neutral",
122
- "positive",
123
- ]
124
- ),
125
- }
126
- ),
127
- supervised_keys=None,
128
- homepage=_HOMEPAGE,
129
- license=_LICENSE,
130
- citation=_CITATION,
131
- )
132
-
133
- def _split_generators(self, dl_manager):
134
- """Returns SplitGenerators."""
135
- data_dir = dl_manager.download_and_extract(_URL)
136
- return [
137
- datasets.SplitGenerator(
138
- name=datasets.Split.TRAIN,
139
- # These kwargs will be passed to _generate_examples
140
- gen_kwargs={"filepath": os.path.join(data_dir, self.config.path)},
141
- ),
142
- ]
143
-
144
- def _generate_examples(self, filepath):
145
- """Yields examples."""
146
- with open(filepath, encoding="iso-8859-1") as f:
147
- for id_, line in enumerate(f):
148
- sentence, label = line.rsplit("@", 1)
149
- yield id_, {"sentence": sentence, "label": label}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/FinancialPhraseBank-v1.0.zip → sentences_50agree/train-00000-of-00001.parquet RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0e1a06c4900fdae46091d031068601e3773ba067c7cecb5b0da1dcba5ce989a6
3
- size 681890
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eae09fe517e6f86e72f012a99469bb0f0778d60cf8cf0923c447f6fd607243fb
3
+ size 389574
sentences_66agree/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ad2a628d069bde94e97d1d83afa959c74064a1c9646fce21e80cb4d8979c5b0
3
+ size 336001
sentences_75agree/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:af4a52cee84ad2391f09b17fdcf8b71e67ce5e8fc1fa027ac1f18097fcf5ebde
3
+ size 266540
sentences_allagree/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f44237fb69e757dcc399d0d8ef6193d1ee434ba2a3268990fa9d9332f40faa2d
3
+ size 168765