Upload TexPrax.py
Browse files- TexPrax.py +10 -6
TexPrax.py
CHANGED
|
@@ -11,17 +11,18 @@
|
|
| 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 |
"""TexPrax: Data collected during the project https://texprax.de/ """
|
| 15 |
|
| 16 |
|
| 17 |
import csv
|
| 18 |
-
import json
|
| 19 |
import os
|
| 20 |
import ast
|
|
|
|
| 21 |
|
| 22 |
import datasets
|
| 23 |
|
| 24 |
-
|
| 25 |
_CITATION = """\
|
| 26 |
@article{stangier2022texprax,
|
| 27 |
title={TexPrax: A Messaging Application for Ethical, Real-time Data Collection and Annotation},
|
|
@@ -31,25 +32,26 @@ _CITATION = """\
|
|
| 31 |
}
|
| 32 |
"""
|
| 33 |
|
|
|
|
| 34 |
_DESCRIPTION = """\
|
| 35 |
This dataset was collected in the [TexPrax](https://texprax.de/) project and contains named entities annotated by three researchers as well as annotated sentences (problem/P, cause/C, solution/S, and other/O).
|
| 36 |
|
| 37 |
"""
|
| 38 |
|
|
|
|
| 39 |
_HOMEPAGE = "https://texprax.de/"
|
| 40 |
|
|
|
|
| 41 |
_LICENSE = "Creative Commons Attribution-NonCommercial 4.0"
|
| 42 |
|
| 43 |
-
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
| 44 |
-
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
| 45 |
|
|
|
|
| 46 |
_SENTENCE_URL = "https://tudatalib.ulb.tu-darmstadt.de/bitstream/handle/tudatalib/3534/texprax-sentences.zip?sequence=8&isAllowed=y"
|
| 47 |
-
|
| 48 |
_ENTITY_URL = "https://tudatalib.ulb.tu-darmstadt.de/bitstream/handle/tudatalib/3534/texprax-ner.zip?sequence=9&isAllowed=y"
|
| 49 |
|
| 50 |
class TexPraxConfig(datasets.BuilderConfig):
|
| 51 |
"""BuilderConfig for TexPrax."""
|
| 52 |
-
def __init__(self, features, data_url, citation, url, label_classes, **kwargs):
|
| 53 |
super(TexPraxConfig, self).__init__(**kwargs)
|
| 54 |
|
| 55 |
|
|
@@ -205,6 +207,8 @@ class TexPraxDataset(datasets.GeneratorBasedBuilder):
|
|
| 205 |
for key, row in enumerate(creader):
|
| 206 |
if self.config.name == "sentence_cl":
|
| 207 |
idx, sentence, label, split = row
|
|
|
|
|
|
|
| 208 |
# Yields examples as (key, example) tuples
|
| 209 |
yield key, {
|
| 210 |
"id": idx,
|
|
|
|
| 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 |
+
# TODO: Add description
|
| 15 |
"""TexPrax: Data collected during the project https://texprax.de/ """
|
| 16 |
|
| 17 |
|
| 18 |
import csv
|
|
|
|
| 19 |
import os
|
| 20 |
import ast
|
| 21 |
+
#import json
|
| 22 |
|
| 23 |
import datasets
|
| 24 |
|
| 25 |
+
# TODO: Add citation
|
| 26 |
_CITATION = """\
|
| 27 |
@article{stangier2022texprax,
|
| 28 |
title={TexPrax: A Messaging Application for Ethical, Real-time Data Collection and Annotation},
|
|
|
|
| 32 |
}
|
| 33 |
"""
|
| 34 |
|
| 35 |
+
# TODO: Add description
|
| 36 |
_DESCRIPTION = """\
|
| 37 |
This dataset was collected in the [TexPrax](https://texprax.de/) project and contains named entities annotated by three researchers as well as annotated sentences (problem/P, cause/C, solution/S, and other/O).
|
| 38 |
|
| 39 |
"""
|
| 40 |
|
| 41 |
+
# TODO: Add link
|
| 42 |
_HOMEPAGE = "https://texprax.de/"
|
| 43 |
|
| 44 |
+
# TODO: Add license
|
| 45 |
_LICENSE = "Creative Commons Attribution-NonCommercial 4.0"
|
| 46 |
|
|
|
|
|
|
|
| 47 |
|
| 48 |
+
# TODO: Add tudatalib urls here!
|
| 49 |
_SENTENCE_URL = "https://tudatalib.ulb.tu-darmstadt.de/bitstream/handle/tudatalib/3534/texprax-sentences.zip?sequence=8&isAllowed=y"
|
|
|
|
| 50 |
_ENTITY_URL = "https://tudatalib.ulb.tu-darmstadt.de/bitstream/handle/tudatalib/3534/texprax-ner.zip?sequence=9&isAllowed=y"
|
| 51 |
|
| 52 |
class TexPraxConfig(datasets.BuilderConfig):
|
| 53 |
"""BuilderConfig for TexPrax."""
|
| 54 |
+
def __init__(self, features, data_url, citation, url, label_classes=("False", "True"), **kwargs):
|
| 55 |
super(TexPraxConfig, self).__init__(**kwargs)
|
| 56 |
|
| 57 |
|
|
|
|
| 207 |
for key, row in enumerate(creader):
|
| 208 |
if self.config.name == "sentence_cl":
|
| 209 |
idx, sentence, label, split = row
|
| 210 |
+
if label=="U":
|
| 211 |
+
print("Error in ", idx)
|
| 212 |
# Yields examples as (key, example) tuples
|
| 213 |
yield key, {
|
| 214 |
"id": idx,
|