Datasets:
Tasks:
Token Classification
Sub-tasks:
named-entity-recognition
Languages:
English
Size:
10K<n<100K
License:
Francisco Castillo
commited on
Commit
•
bf41ba8
1
Parent(s):
2bb85e6
First commit
Browse files- .gitattributes +3 -0
- README.md +142 -0
- production.csv +3 -0
- training.csv +3 -0
- validation.csv +3 -0
- xtreme_en_language_drift_es.py +177 -0
.gitattributes
CHANGED
@@ -35,3 +35,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
35 |
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
36 |
*.ogg filter=lfs diff=lfs merge=lfs -text
|
37 |
*.wav filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
35 |
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
36 |
*.ogg filter=lfs diff=lfs merge=lfs -text
|
37 |
*.wav filter=lfs diff=lfs merge=lfs -text
|
38 |
+
production.csv filter=lfs diff=lfs merge=lfs -text
|
39 |
+
training.csv filter=lfs diff=lfs merge=lfs -text
|
40 |
+
validation.csv filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- expert-generated
|
4 |
+
language_creators:
|
5 |
+
- expert-generated
|
6 |
+
languages:
|
7 |
+
- en
|
8 |
+
licenses:
|
9 |
+
- mit
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
pretty_name: named-entity-recognition-en-no-drift
|
13 |
+
size_categories:
|
14 |
+
- 10K<n<100K
|
15 |
+
source_datasets:
|
16 |
+
- extended|xtreme
|
17 |
+
task_categories:
|
18 |
+
- token-classification
|
19 |
+
task_ids:
|
20 |
+
- named-entity-recognition
|
21 |
+
---
|
22 |
+
|
23 |
+
# Dataset Card for `reviews_with_drift`
|
24 |
+
|
25 |
+
## Table of Contents
|
26 |
+
- [Table of Contents](#table-of-contents)
|
27 |
+
- [Dataset Description](#dataset-description)
|
28 |
+
- [Dataset Summary](#dataset-summary)
|
29 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
30 |
+
- [Languages](#languages)
|
31 |
+
- [Dataset Structure](#dataset-structure)
|
32 |
+
- [Data Instances](#data-instances)
|
33 |
+
- [Data Fields](#data-fields)
|
34 |
+
- [Data Splits](#data-splits)
|
35 |
+
- [Dataset Creation](#dataset-creation)
|
36 |
+
- [Curation Rationale](#curation-rationale)
|
37 |
+
- [Source Data](#source-data)
|
38 |
+
- [Annotations](#annotations)
|
39 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
40 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
41 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
42 |
+
- [Discussion of Biases](#discussion-of-biases)
|
43 |
+
- [Other Known Limitations](#other-known-limitations)
|
44 |
+
- [Additional Information](#additional-information)
|
45 |
+
- [Dataset Curators](#dataset-curators)
|
46 |
+
- [Licensing Information](#licensing-information)
|
47 |
+
- [Citation Information](#citation-information)
|
48 |
+
- [Contributions](#contributions)
|
49 |
+
|
50 |
+
## Dataset Description
|
51 |
+
|
52 |
+
### Dataset Summary
|
53 |
+
|
54 |
+
This dataset was crafted to be used in our tutorial [Link to the tutorial when ready]. It consists on a large Movie Review Dataset mixed with some reviews from a Hotel Review Dataset. The training/validation set are purely obtained from the Movie Review Dataset while the production set is mixed. Some other features have been added (`age`, `gender`, `context`) as well as a made up timestamp `prediction_ts` of when the inference took place.
|
55 |
+
|
56 |
+
### Supported Tasks and Leaderboards
|
57 |
+
|
58 |
+
`text-classification`, `sentiment-classification`: The dataset is mainly used for text classification: given the text, predict the sentiment (positive or negative).
|
59 |
+
|
60 |
+
### Languages
|
61 |
+
|
62 |
+
Text is mainly written in english.
|
63 |
+
|
64 |
+
## Dataset Structure
|
65 |
+
|
66 |
+
### Data Instances
|
67 |
+
|
68 |
+
[More Information Needed]
|
69 |
+
|
70 |
+
### Data Fields
|
71 |
+
|
72 |
+
[More Information Needed]
|
73 |
+
|
74 |
+
### Data Splits
|
75 |
+
|
76 |
+
[More Information Needed]
|
77 |
+
|
78 |
+
## Dataset Creation
|
79 |
+
|
80 |
+
### Curation Rationale
|
81 |
+
|
82 |
+
[More Information Needed]
|
83 |
+
|
84 |
+
### Source Data
|
85 |
+
|
86 |
+
[More Information Needed]
|
87 |
+
|
88 |
+
#### Initial Data Collection and Normalization
|
89 |
+
|
90 |
+
[More Information Needed]
|
91 |
+
|
92 |
+
#### Who are the source language producers?
|
93 |
+
|
94 |
+
[More Information Needed]
|
95 |
+
|
96 |
+
### Annotations
|
97 |
+
|
98 |
+
[More Information Needed]
|
99 |
+
|
100 |
+
#### Annotation process
|
101 |
+
|
102 |
+
[More Information Needed]
|
103 |
+
|
104 |
+
#### Who are the annotators?
|
105 |
+
|
106 |
+
[More Information Needed]
|
107 |
+
|
108 |
+
### Personal and Sensitive Information
|
109 |
+
|
110 |
+
[More Information Needed]
|
111 |
+
|
112 |
+
## Considerations for Using the Data
|
113 |
+
|
114 |
+
### Social Impact of Dataset
|
115 |
+
|
116 |
+
[More Information Needed]
|
117 |
+
|
118 |
+
### Discussion of Biases
|
119 |
+
|
120 |
+
[More Information Needed]
|
121 |
+
|
122 |
+
### Other Known Limitations
|
123 |
+
|
124 |
+
[More Information Needed]
|
125 |
+
|
126 |
+
## Additional Information
|
127 |
+
|
128 |
+
### Dataset Curators
|
129 |
+
|
130 |
+
[More Information Needed]
|
131 |
+
|
132 |
+
### Licensing Information
|
133 |
+
|
134 |
+
[More Information Needed]
|
135 |
+
|
136 |
+
### Citation Information
|
137 |
+
|
138 |
+
[More Information Needed]
|
139 |
+
|
140 |
+
### Contributions
|
141 |
+
|
142 |
+
Thanks to [@fjcasti1](https://github.com/fjcasti1) for adding this dataset.
|
production.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5ad358e24a606591d02464895c071edb9c2d95fe662b1b20a03d0e6594ac6454
|
3 |
+
size 2348706
|
training.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:33628190cd151b05f1b57554a471afa34dea74f3fa1ecf27b8cea1477ce94a3d
|
3 |
+
size 757570
|
validation.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1341e8b532a7256492c3e68fde78f2c80796d08c3eb88ac08669d572c98cc529
|
3 |
+
size 75095
|
xtreme_en_language_drift_es.py
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
2 |
+
#
|
3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
+
# you may not use this file except in compliance with the License.
|
5 |
+
# You may obtain a copy of the License at
|
6 |
+
#
|
7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
+
#
|
9 |
+
# Unless required by applicable law or agreed to in writing, software
|
10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
+
# See the License for the specific language governing permissions and
|
13 |
+
# limitations under the License.
|
14 |
+
|
15 |
+
# Lint as: python3
|
16 |
+
"""IMDb movie revies dataset mixed with Trip Advisor Hotel Reviews to simulate drift accross time."""
|
17 |
+
|
18 |
+
|
19 |
+
import csv
|
20 |
+
import json
|
21 |
+
import os
|
22 |
+
|
23 |
+
import datasets
|
24 |
+
from datasets.tasks import TextClassification
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
+
# TODO: Add BibTeX citation to our BLOG
|
29 |
+
# Find for instance the citation on arxiv or on the dataset repo/website
|
30 |
+
_CITATION = ""
|
31 |
+
# _CITATION = """\
|
32 |
+
# @InProceedings{huggingface:dataset,
|
33 |
+
# title = {A great new dataset},
|
34 |
+
# author={huggingface, Inc.
|
35 |
+
# },
|
36 |
+
# year={2020}
|
37 |
+
# }
|
38 |
+
# """
|
39 |
+
|
40 |
+
# TODO: Add description of the dataset here
|
41 |
+
# You can copy an official description
|
42 |
+
_DESCRIPTION = """\
|
43 |
+
This dataset was crafted to be used in our tutorial [Link to the tutorial when
|
44 |
+
ready]. It consists on product reviews from an e-commerce store. The reviews
|
45 |
+
are labeled on a scale from 1 to 5 (stars). The training & validation sets are
|
46 |
+
fully composed by reviews written in english. However, the production set has
|
47 |
+
some reviews written in spanish. At Arize, we work to surface this issue and
|
48 |
+
help you solve it.
|
49 |
+
"""
|
50 |
+
|
51 |
+
# TODO: Add a link to an official homepage for the dataset here
|
52 |
+
_HOMEPAGE = ""
|
53 |
+
|
54 |
+
# TODO: Add the licence for the dataset here if you can find it
|
55 |
+
_LICENSE = ""
|
56 |
+
|
57 |
+
# TODO: Add link to the official dataset URLs here
|
58 |
+
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
59 |
+
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
60 |
+
_URL = "https://huggingface.co/datasets/arize-ai/xtreme_en_language_drift_es/resolve/main/"
|
61 |
+
_URLS = {
|
62 |
+
"training": _URL + "training.csv",
|
63 |
+
"validation": _URL + "validation.csv",
|
64 |
+
"production": _URL + "production.csv",
|
65 |
+
}
|
66 |
+
|
67 |
+
|
68 |
+
# TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
|
69 |
+
class XtremeNEREnEs(datasets.GeneratorBasedBuilder):
|
70 |
+
"""TODO: Short description of my dataset."""
|
71 |
+
|
72 |
+
VERSION = datasets.Version("1.0.0")
|
73 |
+
|
74 |
+
# This is an example of a dataset with multiple configurations.
|
75 |
+
# If you don't want/need to define several sub-sets in your dataset,
|
76 |
+
# just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
|
77 |
+
|
78 |
+
# If you need to make complex sub-parts in the datasets with configurable options
|
79 |
+
# You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
|
80 |
+
# BUILDER_CONFIG_CLASS = MyBuilderConfig
|
81 |
+
|
82 |
+
# You will be able to load one or the other configurations in the following list with
|
83 |
+
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
84 |
+
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
85 |
+
BUILDER_CONFIGS = [
|
86 |
+
datasets.BuilderConfig(name="default", version=VERSION, description="Default"),
|
87 |
+
]
|
88 |
+
|
89 |
+
DEFAULT_CONFIG_NAME = "default" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
90 |
+
|
91 |
+
def _info(self):
|
92 |
+
# This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
93 |
+
features = datasets.Features(
|
94 |
+
# These are the features of your dataset like images, labels ...
|
95 |
+
{
|
96 |
+
"prediction_ts": datasets.Value("float"),
|
97 |
+
"language":datasets.Value("string"),
|
98 |
+
"split_text": datasets.Sequence(datasets.Value("string")),
|
99 |
+
"ner_tags": datasets.Sequence(
|
100 |
+
datasets.features.ClassLabel(
|
101 |
+
names=[
|
102 |
+
"O",
|
103 |
+
"B-PER",
|
104 |
+
"I-PER",
|
105 |
+
"B-ORG",
|
106 |
+
"I-ORG",
|
107 |
+
"B-LOC",
|
108 |
+
"I-LOC",
|
109 |
+
]
|
110 |
+
)
|
111 |
+
),
|
112 |
+
}
|
113 |
+
)
|
114 |
+
|
115 |
+
return datasets.DatasetInfo(
|
116 |
+
# This is the description that will appear on the datasets page.
|
117 |
+
description=_DESCRIPTION,
|
118 |
+
# This defines the different columns of the dataset and their types
|
119 |
+
features=features, # Here we define them above because they are different between the two configurations
|
120 |
+
# Homepage of the dataset for documentation
|
121 |
+
# License for the dataset if available
|
122 |
+
license=_LICENSE,
|
123 |
+
# Citation for the dataset
|
124 |
+
citation=_CITATION,
|
125 |
+
)
|
126 |
+
|
127 |
+
def _split_generators(self, dl_manager):
|
128 |
+
# This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
129 |
+
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
130 |
+
|
131 |
+
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
132 |
+
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
133 |
+
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
134 |
+
extracted_paths = dl_manager.download_and_extract(_URLS)
|
135 |
+
return [
|
136 |
+
datasets.SplitGenerator(
|
137 |
+
name=datasets.Split("training"),
|
138 |
+
# These kwargs will be passed to _generate_examples
|
139 |
+
gen_kwargs={
|
140 |
+
"filepath": extracted_paths['training'],
|
141 |
+
},
|
142 |
+
),
|
143 |
+
datasets.SplitGenerator(
|
144 |
+
name=datasets.Split("validation"),
|
145 |
+
# These kwargs will be passed to _generate_examples
|
146 |
+
gen_kwargs={
|
147 |
+
"filepath": extracted_paths['validation'],
|
148 |
+
},
|
149 |
+
),
|
150 |
+
datasets.SplitGenerator(
|
151 |
+
name=datasets.Split("production"),
|
152 |
+
# These kwargs will be passed to _generate_examples
|
153 |
+
gen_kwargs={
|
154 |
+
"filepath": extracted_paths['production'],
|
155 |
+
},
|
156 |
+
),
|
157 |
+
]
|
158 |
+
|
159 |
+
|
160 |
+
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
161 |
+
def _generate_examples(self, filepath):
|
162 |
+
# This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
163 |
+
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
164 |
+
with open(filepath) as csv_file:
|
165 |
+
csv_reader = csv.reader(csv_file, delimiter='\t')
|
166 |
+
for id_, row in enumerate(csv_reader):
|
167 |
+
prediction_ts,language,text,ner_tags = row
|
168 |
+
ner_tags_list = list(ner_tags.strip('[]').split(' '))
|
169 |
+
tokens = text.split(":-:")
|
170 |
+
if id_==0:
|
171 |
+
continue
|
172 |
+
yield id_, {
|
173 |
+
"prediction_ts":prediction_ts,
|
174 |
+
"language":language,
|
175 |
+
"split_text": tokens,
|
176 |
+
"ner_tags":ner_tags_list,
|
177 |
+
}
|