Datasets:
Tasks:
Token Classification
Modalities:
Text
Formats:
json
Sub-tasks:
named-entity-recognition
Languages:
English
Size:
100K - 1M
Tags:
pii-detection
License:
Commit ·
4e5afc3
0
Parent(s):
Duplicate from beki/privy
Browse filesCo-authored-by: Benjamin Kilimnik <beki@users.noreply.huggingface.co>
- .gitattributes +66 -0
- README.md +177 -0
- dataset_infos.json +1 -0
- privy-dataset.zip +3 -0
- privy.py +433 -0
.gitattributes
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lz4 filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
# Audio files - uncompressed
|
| 34 |
+
*.pcm filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*.sam filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.raw filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
# Audio files - compressed
|
| 38 |
+
*.aac filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
*.flac filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
*.ogg filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
*.wav filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
# Image files - uncompressed
|
| 44 |
+
*.bmp filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
*.gif filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
*.tiff filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
# Image files - compressed
|
| 49 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
privy-small-input-samples.json filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
privy-small.json filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
BILUO-test.txt filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
privy-small-BILUO-test.txt filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
privy-small-BILUO-train.txt filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
privy-large.json filter=lfs diff=lfs merge=lfs -text
|
| 58 |
+
privy-large-input-samples.json filter=lfs diff=lfs merge=lfs -text
|
| 59 |
+
dev-large.json filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
test-large.json filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
test-small.json filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
dev-small.json filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
train-small.json filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
train-large.json filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
BILUO-test-small.txt filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
BILUO-train-small.txt filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license:
|
| 5 |
+
- mit
|
| 6 |
+
multilinguality:
|
| 7 |
+
- monolingual
|
| 8 |
+
size_categories:
|
| 9 |
+
- 100K<n<200K
|
| 10 |
+
- 300K<n<400K
|
| 11 |
+
task_categories:
|
| 12 |
+
- token-classification
|
| 13 |
+
task_ids:
|
| 14 |
+
- named-entity-recognition
|
| 15 |
+
tags:
|
| 16 |
+
- pii-detection
|
| 17 |
+
train-eval-index:
|
| 18 |
+
- config: privy-small
|
| 19 |
+
task: token-classification
|
| 20 |
+
task_id: entity_extraction
|
| 21 |
+
splits:
|
| 22 |
+
train_split: train
|
| 23 |
+
eval_split: test
|
| 24 |
+
metrics:
|
| 25 |
+
- type: seqeval
|
| 26 |
+
name: seqeval
|
| 27 |
+
pretty_name: Privy English
|
| 28 |
+
---
|
| 29 |
+
|
| 30 |
+
# Dataset Card for "privy-english"
|
| 31 |
+
|
| 32 |
+
## Table of Contents
|
| 33 |
+
- [Dataset Description](#dataset-description)
|
| 34 |
+
- [Dataset Summary](#dataset-summary)
|
| 35 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
| 36 |
+
- [Languages](#languages)
|
| 37 |
+
- [Dataset Structure](#dataset-structure)
|
| 38 |
+
- [Data Instances](#data-instances)
|
| 39 |
+
- [Data Fields](#data-fields)
|
| 40 |
+
- [Data Splits](#data-splits)
|
| 41 |
+
- [Dataset Creation](#dataset-creation)
|
| 42 |
+
- [Curation Rationale](#curation-rationale)
|
| 43 |
+
- [Source Data](#source-data)
|
| 44 |
+
- [Annotations](#annotations)
|
| 45 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
| 46 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
| 47 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
| 48 |
+
- [Discussion of Biases](#discussion-of-biases)
|
| 49 |
+
- [Other Known Limitations](#other-known-limitations)
|
| 50 |
+
- [Additional Information](#additional-information)
|
| 51 |
+
- [Dataset Curators](#dataset-curators)
|
| 52 |
+
- [Licensing Information](#licensing-information)
|
| 53 |
+
- [Citation Information](#citation-information)
|
| 54 |
+
- [Contributions](#contributions)
|
| 55 |
+
|
| 56 |
+
## Dataset Description
|
| 57 |
+
|
| 58 |
+
- **Homepage:** [https://github.com/pixie-io/pixie/tree/main/src/datagen/pii/privy](https://github.com/pixie-io/pixie/tree/main/src/datagen/pii/privy)
|
| 59 |
+
|
| 60 |
+
### Dataset Summary
|
| 61 |
+
A synthetic PII dataset generated using [Privy](https://github.com/pixie-io/pixie/tree/main/src/datagen/pii/privy), a tool which parses OpenAPI specifications and generates synthetic request payloads, searching for keywords in API schema definitions to select appropriate data providers. Generated API payloads are converted to various protocol trace formats like JSON and SQL to approximate the data developers might encounter while debugging applications.
|
| 62 |
+
|
| 63 |
+
This labelled PII dataset consists of protocol traces (JSON, SQL (PostgreSQL, MySQL), HTML, and XML) generated from OpenAPI specifications and includes 60+ PII types.
|
| 64 |
+
|
| 65 |
+
### Supported Tasks and Leaderboards
|
| 66 |
+
|
| 67 |
+
Named Entity Recognition (NER) and PII classification.
|
| 68 |
+
|
| 69 |
+
### Label Scheme
|
| 70 |
+
|
| 71 |
+
<details>
|
| 72 |
+
|
| 73 |
+
<summary>View label scheme (26 labels for 60 PII data providers)</summary>
|
| 74 |
+
|
| 75 |
+
| Component | Labels |
|
| 76 |
+
| --- | --- |
|
| 77 |
+
| **`ner`** | `PERSON`, `LOCATION`, `NRP`, `DATE_TIME`, `CREDIT_CARD`, `URL`, `IBAN_CODE`, `US_BANK_NUMBER`, `PHONE_NUMBER`, `US_SSN`, `US_PASSPORT`, `US_DRIVER_LICENSE`, `IP_ADDRESS`, `US_ITIN`, `EMAIL_ADDRESS`, `ORGANIZATION`, `TITLE`, `COORDINATE`, `IMEI`, `PASSWORD`, `LICENSE_PLATE`, `CURRENCY`, `ROUTING_NUMBER`, `SWIFT_CODE`, `MAC_ADDRESS`, `AGE` |
|
| 78 |
+
|
| 79 |
+
</details>
|
| 80 |
+
|
| 81 |
+
### Languages
|
| 82 |
+
|
| 83 |
+
English
|
| 84 |
+
|
| 85 |
+
## Dataset Structure
|
| 86 |
+
|
| 87 |
+
### Data Instances
|
| 88 |
+
|
| 89 |
+
A sample:
|
| 90 |
+
```
|
| 91 |
+
{
|
| 92 |
+
"full_text": "{\"full_name_female\": \"Bethany Williams\", \"NewServerCertificateName\": \"\", \"NewPath\": \"\", \"ServerCertificateName\": \"dCwMNqR\", \"Action\": \"\", \"Version\": \"u zNS zNS\"}",
|
| 93 |
+
"masked": "{\"full_name_female\": \"{{name_female}}\", \"NewServerCertificateName\": \"{{string}}\", \"NewPath\": \"{{string}}\", \"ServerCertificateName\": \"{{string}}\", \"Action\": \"{{string}}\", \"Version\": \"{{string}}\"}",
|
| 94 |
+
"spans": [
|
| 95 |
+
{
|
| 96 |
+
"entity_type": "PERSON",
|
| 97 |
+
"entity_value": "Bethany Williams",
|
| 98 |
+
"start_position": 22,
|
| 99 |
+
"end_position": 38
|
| 100 |
+
}
|
| 101 |
+
],
|
| 102 |
+
"template_id": 51889,
|
| 103 |
+
"metadata": null
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
## Dataset Creation
|
| 109 |
+
|
| 110 |
+
### Curation Rationale
|
| 111 |
+
|
| 112 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 113 |
+
|
| 114 |
+
### Source Data
|
| 115 |
+
|
| 116 |
+
#### Initial Data Collection and Normalization
|
| 117 |
+
|
| 118 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 119 |
+
|
| 120 |
+
#### Who are the source language producers?
|
| 121 |
+
|
| 122 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 123 |
+
|
| 124 |
+
### Annotations
|
| 125 |
+
|
| 126 |
+
#### Annotation process
|
| 127 |
+
|
| 128 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 129 |
+
|
| 130 |
+
#### Who are the annotators?
|
| 131 |
+
|
| 132 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 133 |
+
|
| 134 |
+
### Personal and Sensitive Information
|
| 135 |
+
|
| 136 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 137 |
+
|
| 138 |
+
## Considerations for Using the Data
|
| 139 |
+
|
| 140 |
+
### Social Impact of Dataset
|
| 141 |
+
|
| 142 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 143 |
+
|
| 144 |
+
### Discussion of Biases
|
| 145 |
+
|
| 146 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 147 |
+
|
| 148 |
+
### Other Known Limitations
|
| 149 |
+
|
| 150 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 151 |
+
|
| 152 |
+
## Additional Information
|
| 153 |
+
|
| 154 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 155 |
+
|
| 156 |
+
### Dataset Curators
|
| 157 |
+
|
| 158 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 159 |
+
|
| 160 |
+
### Licensing Information
|
| 161 |
+
|
| 162 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 163 |
+
|
| 164 |
+
### Citation Information
|
| 165 |
+
|
| 166 |
+
```
|
| 167 |
+
@online{WinNT,
|
| 168 |
+
author = {Benjamin Kilimnik},
|
| 169 |
+
title = {{Privy} Synthetic PII Protocol Trace Dataset},
|
| 170 |
+
year = 2022,
|
| 171 |
+
url = {https://huggingface.co/datasets/beki/privy},
|
| 172 |
+
}
|
| 173 |
+
```
|
| 174 |
+
|
| 175 |
+
### Contributions
|
| 176 |
+
|
| 177 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
dataset_infos.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"small": {"description": "This labelled PII dataset consists of protocol traces (JSON, SQL (PostgreSQL, MySQL), HTML, and XML) generated from OpenAPI specifications and includes 60+ PII types.", "citation": "\n@online{WinNT,\n author = {Benjamin Kilimnik},\n title = {{Privy} Synthetic PII Protocol Trace Dataset},\n year = 2022,\n url = {https://huggingface.co/datasets/beki/privy},\n}\n", "homepage": "https://github.com/pixie-io/pixie/tree/main/src/datagen/pii/privy/privy", "license": "MIT", "features": {"full_text": {"dtype": "string", "id": null, "_type": "Value"}, "masked": {"dtype": "string", "id": null, "_type": "Value"}, "spans": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "tags": {"feature": {"num_classes": 117, "names": ["O", "B-O", "I-O", "L-O", "U-O", "B-PER", "I-PER", "L-PER", "U-PER", "B-LOC", "I-LOC", "L-LOC", "U-LOC", "B-ORG", "I-ORG", "L-ORG", "U-ORG", "B-NRP", "I-NRP", "L-NRP", "U-NRP", "B-DATE_TIME", "I-DATE_TIME", "L-DATE_TIME", "U-DATE_TIME", "B-CREDIT_CARD", "I-CREDIT_CARD", "L-CREDIT_CARD", "U-CREDIT_CARD", "B-URL", "I-URL", "L-URL", "U-URL", "B-IBAN_CODE", "I-IBAN_CODE", "L-IBAN_CODE", "U-IBAN_CODE", "B-US_BANK_NUMBER", "I-US_BANK_NUMBER", "L-US_BANK_NUMBER", "U-US_BANK_NUMBER", "B-PHONE_NUMBER", "I-PHONE_NUMBER", "L-PHONE_NUMBER", "U-PHONE_NUMBER", "B-US_SSN", "I-US_SSN", "L-US_SSN", "U-US_SSN", "B-US_PASSPORT", "I-US_PASSPORT", "L-US_PASSPORT", "U-US_PASSPORT", "B-US_DRIVER_LICENSE", "I-US_DRIVER_LICENSE", "L-US_DRIVER_LICENSE", "U-US_DRIVER_LICENSE", "B-US_LICENSE_PLATE", "I-US_LICENSE_PLATE", "L-US_LICENSE_PLATE", "U-US_LICENSE_PLATE", "B-IP_ADDRESS", "I-IP_ADDRESS", "L-IP_ADDRESS", "U-IP_ADDRESS", "B-US_ITIN", "I-US_ITIN", "L-US_ITIN", "U-US_ITIN", "B-EMAIL_ADDRESS", "I-EMAIL_ADDRESS", "L-EMAIL_ADDRESS", "U-EMAIL_ADDRESS", "B-TITLE", "I-TITLE", "L-TITLE", "U-TITLE", "B-COORDINATE", "I-COORDINATE", "L-COORDINATE", "U-COORDINATE", "B-IMEI", "I-IMEI", "L-IMEI", "U-IMEI", "B-PASSWORD", "I-PASSWORD", "L-PASSWORD", "U-PASSWORD", "B-LICENSE_PLATE", "I-LICENSE_PLATE", "L-LICENSE_PLATE", "U-LICENSE_PLATE", "B-CURRENCY", "I-CURRENCY", "L-CURRENCY", "U-CURRENCY", "B-FINANCIAL", "I-FINANCIAL", "L-FINANCIAL", "U-FINANCIAL", "B-ROUTING_NUMBER", "I-ROUTING_NUMBER", "L-ROUTING_NUMBER", "U-ROUTING_NUMBER", "B-SWIFT_CODE", "I-SWIFT_CODE", "L-SWIFT_CODE", "U-SWIFT_CODE", "B-MAC_ADDRESS", "I-MAC_ADDRESS", "L-MAC_ADDRESS", "U-MAC_ADDRESS", "B-AGE", "I-AGE", "L-AGE", "U-AGE"], "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "template_id": {"dtype": "int32", "id": null, "_type": "Value"}, "metadata": {"dtype": "int32", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "data_loader", "config_name": "small", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 237595211, "num_examples": 100951, "dataset_name": "data_loader"}, "validation": {"name": "validation", "num_bytes": 33794753, "num_examples": 14422, "dataset_name": "data_loader"}, "test": {"name": "test", "num_bytes": 67351264, "num_examples": 28843, "dataset_name": "data_loader"}}, "download_checksums": {"https://huggingface.co/datasets/beki/privy/resolve/main/privy-dataset.zip": {"num_bytes": 307518080, "checksum": "ad4ffbc8f7102a92f01f8d8023ddf4f5244fea6b23c3f116641fe6bbd8cbbde4"}}, "download_size": 307518080, "post_processing_size": null, "dataset_size": 338741228, "size_in_bytes": 646259308}, "large": {"description": "This labelled PII dataset consists of protocol traces (JSON, SQL (PostgreSQL, MySQL), HTML, and XML) generated from OpenAPI specifications and includes 60+ PII types.", "citation": "\n@online{WinNT,\n author = {Benjamin Kilimnik},\n title = {{Privy} Synthetic PII Protocol Trace Dataset},\n year = 2022,\n url = {https://huggingface.co/datasets/beki/privy},\n}\n", "homepage": "https://github.com/pixie-io/pixie/tree/main/src/datagen/pii/privy/privy", "license": "MIT", "features": {"full_text": {"dtype": "string", "id": null, "_type": "Value"}, "masked": {"dtype": "string", "id": null, "_type": "Value"}, "spans": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "tags": {"feature": {"num_classes": 117, "names": ["O", "B-O", "I-O", "L-O", "U-O", "B-PERSON", "I-PERSON", "L-PERSON", "U-PERSON", "B-LOCATION", "I-LOCATION", "L-LOCATION", "U-LOCATION", "B-ORGANIZATION", "I-ORGANIZATION", "L-ORGANIZATION", "U-ORGANIZATION", "B-NRP", "I-NRP", "L-NRP", "U-NRP", "B-DATE_TIME", "I-DATE_TIME", "L-DATE_TIME", "U-DATE_TIME", "B-CREDIT_CARD", "I-CREDIT_CARD", "L-CREDIT_CARD", "U-CREDIT_CARD", "B-URL", "I-URL", "L-URL", "U-URL", "B-IBAN_CODE", "I-IBAN_CODE", "L-IBAN_CODE", "U-IBAN_CODE", "B-US_BANK_NUMBER", "I-US_BANK_NUMBER", "L-US_BANK_NUMBER", "U-US_BANK_NUMBER", "B-PHONE_NUMBER", "I-PHONE_NUMBER", "L-PHONE_NUMBER", "U-PHONE_NUMBER", "B-US_SSN", "I-US_SSN", "L-US_SSN", "U-US_SSN", "B-US_PASSPORT", "I-US_PASSPORT", "L-US_PASSPORT", "U-US_PASSPORT", "B-US_DRIVER_LICENSE", "I-US_DRIVER_LICENSE", "L-US_DRIVER_LICENSE", "U-US_DRIVER_LICENSE", "B-US_LICENSE_PLATE", "I-US_LICENSE_PLATE", "L-US_LICENSE_PLATE", "U-US_LICENSE_PLATE", "B-IP_ADDRESS", "I-IP_ADDRESS", "L-IP_ADDRESS", "U-IP_ADDRESS", "B-US_ITIN", "I-US_ITIN", "L-US_ITIN", "U-US_ITIN", "B-EMAIL_ADDRESS", "I-EMAIL_ADDRESS", "L-EMAIL_ADDRESS", "U-EMAIL_ADDRESS", "B-TITLE", "I-TITLE", "L-TITLE", "U-TITLE", "B-COORDINATE", "I-COORDINATE", "L-COORDINATE", "U-COORDINATE", "B-IMEI", "I-IMEI", "L-IMEI", "U-IMEI", "B-PASSWORD", "I-PASSWORD", "L-PASSWORD", "U-PASSWORD", "B-LICENSE_PLATE", "I-LICENSE_PLATE", "L-LICENSE_PLATE", "U-LICENSE_PLATE", "B-CURRENCY", "I-CURRENCY", "L-CURRENCY", "U-CURRENCY", "B-FINANCIAL", "I-FINANCIAL", "L-FINANCIAL", "U-FINANCIAL", "B-ROUTING_NUMBER", "I-ROUTING_NUMBER", "L-ROUTING_NUMBER", "U-ROUTING_NUMBER", "B-SWIFT_CODE", "I-SWIFT_CODE", "L-SWIFT_CODE", "U-SWIFT_CODE", "B-MAC_ADDRESS", "I-MAC_ADDRESS", "L-MAC_ADDRESS", "U-MAC_ADDRESS", "B-AGE", "I-AGE", "L-AGE", "U-AGE"], "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "template_id": {"dtype": "int32", "id": null, "_type": "Value"}, "metadata": {"dtype": "int32", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "data_loader", "config_name": "large", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1185041570, "num_examples": 422008, "dataset_name": "data_loader"}, "validation": {"name": "validation", "num_bytes": 169735515, "num_examples": 60287, "dataset_name": "data_loader"}, "test": {"name": "test", "num_bytes": 338812586, "num_examples": 120574, "dataset_name": "data_loader"}}, "download_checksums": {"https://huggingface.co/datasets/beki/privy/resolve/main/privy-dataset.zip": {"num_bytes": 307518080, "checksum": "ad4ffbc8f7102a92f01f8d8023ddf4f5244fea6b23c3f116641fe6bbd8cbbde4"}}, "download_size": 307518080, "post_processing_size": null, "dataset_size": 1693589671, "size_in_bytes": 2001107751}}
|
privy-dataset.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ad4ffbc8f7102a92f01f8d8023ddf4f5244fea6b23c3f116641fe6bbd8cbbde4
|
| 3 |
+
size 307518080
|
privy.py
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
import csv
|
| 15 |
+
import json
|
| 16 |
+
import os
|
| 17 |
+
|
| 18 |
+
import datasets
|
| 19 |
+
|
| 20 |
+
_DESCRIPTION="This labelled PII dataset consists of protocol traces (JSON, SQL (PostgreSQL, MySQL), HTML, and XML) generated from OpenAPI specifications and includes 60+ PII types."
|
| 21 |
+
_CITATION="""
|
| 22 |
+
@online{WinNT,
|
| 23 |
+
author = {Benjamin Kilimnik},
|
| 24 |
+
title = {{Privy} Synthetic PII Protocol Trace Dataset},
|
| 25 |
+
year = 2022,
|
| 26 |
+
url = {https://huggingface.co/datasets/beki/privy},
|
| 27 |
+
}
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
_HOMEPAGE = "https://github.com/pixie-io/pixie/tree/main/src/datagen/pii/privy/privy"
|
| 31 |
+
|
| 32 |
+
_LICENSE = "MIT"
|
| 33 |
+
_URL = "https://huggingface.co/datasets/beki/privy/resolve/main/privy-dataset.zip"
|
| 34 |
+
|
| 35 |
+
class Privy(datasets.GeneratorBasedBuilder):
|
| 36 |
+
VERSION = datasets.Version("1.0.0")
|
| 37 |
+
|
| 38 |
+
# You will be able to load one or the other configurations in the following list with
|
| 39 |
+
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
| 40 |
+
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
| 41 |
+
BUILDER_CONFIGS = [
|
| 42 |
+
datasets.BuilderConfig(name="small", version=VERSION, description="Privy small"),
|
| 43 |
+
datasets.BuilderConfig(name="large", version=VERSION, description="Privy large"),
|
| 44 |
+
]
|
| 45 |
+
|
| 46 |
+
DEFAULT_CONFIG_NAME = "small"
|
| 47 |
+
|
| 48 |
+
def _info(self):
|
| 49 |
+
if self.config.name == "large":
|
| 50 |
+
features = datasets.Features(
|
| 51 |
+
{
|
| 52 |
+
"full_text": datasets.Value("string"),
|
| 53 |
+
"masked": datasets.Value("string"),
|
| 54 |
+
"spans": datasets.Sequence(datasets.Value("string")),
|
| 55 |
+
"tags": datasets.Sequence(
|
| 56 |
+
datasets.features.ClassLabel(
|
| 57 |
+
names=[
|
| 58 |
+
"O",
|
| 59 |
+
"B-O",
|
| 60 |
+
"I-O",
|
| 61 |
+
"L-O",
|
| 62 |
+
"U-O",
|
| 63 |
+
|
| 64 |
+
"B-PERSON",
|
| 65 |
+
"I-PERSON",
|
| 66 |
+
"L-PERSON",
|
| 67 |
+
"U-PERSON",
|
| 68 |
+
|
| 69 |
+
"B-LOCATION",
|
| 70 |
+
"I-LOCATION",
|
| 71 |
+
"L-LOCATION",
|
| 72 |
+
"U-LOCATION",
|
| 73 |
+
|
| 74 |
+
"B-ORGANIZATION",
|
| 75 |
+
"I-ORGANIZATION",
|
| 76 |
+
"L-ORGANIZATION",
|
| 77 |
+
"U-ORGANIZATION",
|
| 78 |
+
|
| 79 |
+
"B-NRP",
|
| 80 |
+
"I-NRP",
|
| 81 |
+
"L-NRP",
|
| 82 |
+
"U-NRP",
|
| 83 |
+
|
| 84 |
+
"B-DATE_TIME",
|
| 85 |
+
"I-DATE_TIME",
|
| 86 |
+
"L-DATE_TIME",
|
| 87 |
+
"U-DATE_TIME",
|
| 88 |
+
|
| 89 |
+
"B-CREDIT_CARD",
|
| 90 |
+
"I-CREDIT_CARD",
|
| 91 |
+
"L-CREDIT_CARD",
|
| 92 |
+
"U-CREDIT_CARD",
|
| 93 |
+
|
| 94 |
+
"B-URL",
|
| 95 |
+
"I-URL",
|
| 96 |
+
"L-URL",
|
| 97 |
+
"U-URL",
|
| 98 |
+
|
| 99 |
+
"B-IBAN_CODE",
|
| 100 |
+
"I-IBAN_CODE",
|
| 101 |
+
"L-IBAN_CODE",
|
| 102 |
+
"U-IBAN_CODE",
|
| 103 |
+
|
| 104 |
+
"B-US_BANK_NUMBER",
|
| 105 |
+
"I-US_BANK_NUMBER",
|
| 106 |
+
"L-US_BANK_NUMBER",
|
| 107 |
+
"U-US_BANK_NUMBER",
|
| 108 |
+
|
| 109 |
+
"B-PHONE_NUMBER",
|
| 110 |
+
"I-PHONE_NUMBER",
|
| 111 |
+
"L-PHONE_NUMBER",
|
| 112 |
+
"U-PHONE_NUMBER",
|
| 113 |
+
|
| 114 |
+
"B-US_SSN",
|
| 115 |
+
"I-US_SSN",
|
| 116 |
+
"L-US_SSN",
|
| 117 |
+
"U-US_SSN",
|
| 118 |
+
|
| 119 |
+
"B-US_PASSPORT",
|
| 120 |
+
"I-US_PASSPORT",
|
| 121 |
+
"L-US_PASSPORT",
|
| 122 |
+
"U-US_PASSPORT",
|
| 123 |
+
|
| 124 |
+
"B-US_DRIVER_LICENSE",
|
| 125 |
+
"I-US_DRIVER_LICENSE",
|
| 126 |
+
"L-US_DRIVER_LICENSE",
|
| 127 |
+
"U-US_DRIVER_LICENSE",
|
| 128 |
+
|
| 129 |
+
"B-US_LICENSE_PLATE",
|
| 130 |
+
"I-US_LICENSE_PLATE",
|
| 131 |
+
"L-US_LICENSE_PLATE",
|
| 132 |
+
"U-US_LICENSE_PLATE",
|
| 133 |
+
|
| 134 |
+
"B-IP_ADDRESS",
|
| 135 |
+
"I-IP_ADDRESS",
|
| 136 |
+
"L-IP_ADDRESS",
|
| 137 |
+
"U-IP_ADDRESS",
|
| 138 |
+
|
| 139 |
+
"B-US_ITIN",
|
| 140 |
+
"I-US_ITIN",
|
| 141 |
+
"L-US_ITIN",
|
| 142 |
+
"U-US_ITIN",
|
| 143 |
+
|
| 144 |
+
"B-EMAIL_ADDRESS",
|
| 145 |
+
"I-EMAIL_ADDRESS",
|
| 146 |
+
"L-EMAIL_ADDRESS",
|
| 147 |
+
"U-EMAIL_ADDRESS",
|
| 148 |
+
|
| 149 |
+
"B-TITLE",
|
| 150 |
+
"I-TITLE",
|
| 151 |
+
"L-TITLE",
|
| 152 |
+
"U-TITLE",
|
| 153 |
+
|
| 154 |
+
"B-COORDINATE",
|
| 155 |
+
"I-COORDINATE",
|
| 156 |
+
"L-COORDINATE",
|
| 157 |
+
"U-COORDINATE",
|
| 158 |
+
|
| 159 |
+
"B-IMEI",
|
| 160 |
+
"I-IMEI",
|
| 161 |
+
"L-IMEI",
|
| 162 |
+
"U-IMEI",
|
| 163 |
+
|
| 164 |
+
"B-PASSWORD",
|
| 165 |
+
"I-PASSWORD",
|
| 166 |
+
"L-PASSWORD",
|
| 167 |
+
"U-PASSWORD",
|
| 168 |
+
|
| 169 |
+
"B-LICENSE_PLATE",
|
| 170 |
+
"I-LICENSE_PLATE",
|
| 171 |
+
"L-LICENSE_PLATE",
|
| 172 |
+
"U-LICENSE_PLATE",
|
| 173 |
+
|
| 174 |
+
"B-CURRENCY",
|
| 175 |
+
"I-CURRENCY",
|
| 176 |
+
"L-CURRENCY",
|
| 177 |
+
"U-CURRENCY",
|
| 178 |
+
|
| 179 |
+
"B-FINANCIAL",
|
| 180 |
+
"I-FINANCIAL",
|
| 181 |
+
"L-FINANCIAL",
|
| 182 |
+
"U-FINANCIAL",
|
| 183 |
+
|
| 184 |
+
"B-ROUTING_NUMBER",
|
| 185 |
+
"I-ROUTING_NUMBER",
|
| 186 |
+
"L-ROUTING_NUMBER",
|
| 187 |
+
"U-ROUTING_NUMBER",
|
| 188 |
+
|
| 189 |
+
"B-SWIFT_CODE",
|
| 190 |
+
"I-SWIFT_CODE",
|
| 191 |
+
"L-SWIFT_CODE",
|
| 192 |
+
"U-SWIFT_CODE",
|
| 193 |
+
|
| 194 |
+
"B-MAC_ADDRESS",
|
| 195 |
+
"I-MAC_ADDRESS",
|
| 196 |
+
"L-MAC_ADDRESS",
|
| 197 |
+
"U-MAC_ADDRESS",
|
| 198 |
+
|
| 199 |
+
"B-AGE",
|
| 200 |
+
"I-AGE",
|
| 201 |
+
"L-AGE",
|
| 202 |
+
"U-AGE",
|
| 203 |
+
]
|
| 204 |
+
)
|
| 205 |
+
),
|
| 206 |
+
"tokens": datasets.Sequence(datasets.Value("string")),
|
| 207 |
+
"template_id": datasets.Value("int32"),
|
| 208 |
+
"metadata": datasets.Value("int32"),
|
| 209 |
+
}
|
| 210 |
+
)
|
| 211 |
+
if self.config.name == "small":
|
| 212 |
+
features = datasets.Features(
|
| 213 |
+
{
|
| 214 |
+
"full_text": datasets.Value("string"),
|
| 215 |
+
"masked": datasets.Value("string"),
|
| 216 |
+
"spans": datasets.Sequence(datasets.Value("string")),
|
| 217 |
+
"tags": datasets.Sequence(
|
| 218 |
+
datasets.features.ClassLabel(
|
| 219 |
+
names=[
|
| 220 |
+
"O",
|
| 221 |
+
"B-O",
|
| 222 |
+
"I-O",
|
| 223 |
+
"L-O",
|
| 224 |
+
"U-O",
|
| 225 |
+
|
| 226 |
+
"B-PER",
|
| 227 |
+
"I-PER",
|
| 228 |
+
"L-PER",
|
| 229 |
+
"U-PER",
|
| 230 |
+
|
| 231 |
+
"B-LOC",
|
| 232 |
+
"I-LOC",
|
| 233 |
+
"L-LOC",
|
| 234 |
+
"U-LOC",
|
| 235 |
+
|
| 236 |
+
"B-ORG",
|
| 237 |
+
"I-ORG",
|
| 238 |
+
"L-ORG",
|
| 239 |
+
"U-ORG",
|
| 240 |
+
|
| 241 |
+
"B-NRP",
|
| 242 |
+
"I-NRP",
|
| 243 |
+
"L-NRP",
|
| 244 |
+
"U-NRP",
|
| 245 |
+
|
| 246 |
+
"B-DATE_TIME",
|
| 247 |
+
"I-DATE_TIME",
|
| 248 |
+
"L-DATE_TIME",
|
| 249 |
+
"U-DATE_TIME",
|
| 250 |
+
|
| 251 |
+
"B-CREDIT_CARD",
|
| 252 |
+
"I-CREDIT_CARD",
|
| 253 |
+
"L-CREDIT_CARD",
|
| 254 |
+
"U-CREDIT_CARD",
|
| 255 |
+
|
| 256 |
+
"B-URL",
|
| 257 |
+
"I-URL",
|
| 258 |
+
"L-URL",
|
| 259 |
+
"U-URL",
|
| 260 |
+
|
| 261 |
+
"B-IBAN_CODE",
|
| 262 |
+
"I-IBAN_CODE",
|
| 263 |
+
"L-IBAN_CODE",
|
| 264 |
+
"U-IBAN_CODE",
|
| 265 |
+
|
| 266 |
+
"B-US_BANK_NUMBER",
|
| 267 |
+
"I-US_BANK_NUMBER",
|
| 268 |
+
"L-US_BANK_NUMBER",
|
| 269 |
+
"U-US_BANK_NUMBER",
|
| 270 |
+
|
| 271 |
+
"B-PHONE_NUMBER",
|
| 272 |
+
"I-PHONE_NUMBER",
|
| 273 |
+
"L-PHONE_NUMBER",
|
| 274 |
+
"U-PHONE_NUMBER",
|
| 275 |
+
|
| 276 |
+
"B-US_SSN",
|
| 277 |
+
"I-US_SSN",
|
| 278 |
+
"L-US_SSN",
|
| 279 |
+
"U-US_SSN",
|
| 280 |
+
|
| 281 |
+
"B-US_PASSPORT",
|
| 282 |
+
"I-US_PASSPORT",
|
| 283 |
+
"L-US_PASSPORT",
|
| 284 |
+
"U-US_PASSPORT",
|
| 285 |
+
|
| 286 |
+
"B-US_DRIVER_LICENSE",
|
| 287 |
+
"I-US_DRIVER_LICENSE",
|
| 288 |
+
"L-US_DRIVER_LICENSE",
|
| 289 |
+
"U-US_DRIVER_LICENSE",
|
| 290 |
+
|
| 291 |
+
"B-US_LICENSE_PLATE",
|
| 292 |
+
"I-US_LICENSE_PLATE",
|
| 293 |
+
"L-US_LICENSE_PLATE",
|
| 294 |
+
"U-US_LICENSE_PLATE",
|
| 295 |
+
|
| 296 |
+
"B-IP_ADDRESS",
|
| 297 |
+
"I-IP_ADDRESS",
|
| 298 |
+
"L-IP_ADDRESS",
|
| 299 |
+
"U-IP_ADDRESS",
|
| 300 |
+
|
| 301 |
+
"B-US_ITIN",
|
| 302 |
+
"I-US_ITIN",
|
| 303 |
+
"L-US_ITIN",
|
| 304 |
+
"U-US_ITIN",
|
| 305 |
+
|
| 306 |
+
"B-EMAIL_ADDRESS",
|
| 307 |
+
"I-EMAIL_ADDRESS",
|
| 308 |
+
"L-EMAIL_ADDRESS",
|
| 309 |
+
"U-EMAIL_ADDRESS",
|
| 310 |
+
|
| 311 |
+
"B-TITLE",
|
| 312 |
+
"I-TITLE",
|
| 313 |
+
"L-TITLE",
|
| 314 |
+
"U-TITLE",
|
| 315 |
+
|
| 316 |
+
"B-COORDINATE",
|
| 317 |
+
"I-COORDINATE",
|
| 318 |
+
"L-COORDINATE",
|
| 319 |
+
"U-COORDINATE",
|
| 320 |
+
|
| 321 |
+
"B-IMEI",
|
| 322 |
+
"I-IMEI",
|
| 323 |
+
"L-IMEI",
|
| 324 |
+
"U-IMEI",
|
| 325 |
+
|
| 326 |
+
"B-PASSWORD",
|
| 327 |
+
"I-PASSWORD",
|
| 328 |
+
"L-PASSWORD",
|
| 329 |
+
"U-PASSWORD",
|
| 330 |
+
|
| 331 |
+
"B-LICENSE_PLATE",
|
| 332 |
+
"I-LICENSE_PLATE",
|
| 333 |
+
"L-LICENSE_PLATE",
|
| 334 |
+
"U-LICENSE_PLATE",
|
| 335 |
+
|
| 336 |
+
"B-CURRENCY",
|
| 337 |
+
"I-CURRENCY",
|
| 338 |
+
"L-CURRENCY",
|
| 339 |
+
"U-CURRENCY",
|
| 340 |
+
|
| 341 |
+
"B-FINANCIAL",
|
| 342 |
+
"I-FINANCIAL",
|
| 343 |
+
"L-FINANCIAL",
|
| 344 |
+
"U-FINANCIAL",
|
| 345 |
+
|
| 346 |
+
"B-ROUTING_NUMBER",
|
| 347 |
+
"I-ROUTING_NUMBER",
|
| 348 |
+
"L-ROUTING_NUMBER",
|
| 349 |
+
"U-ROUTING_NUMBER",
|
| 350 |
+
|
| 351 |
+
"B-SWIFT_CODE",
|
| 352 |
+
"I-SWIFT_CODE",
|
| 353 |
+
"L-SWIFT_CODE",
|
| 354 |
+
"U-SWIFT_CODE",
|
| 355 |
+
|
| 356 |
+
"B-MAC_ADDRESS",
|
| 357 |
+
"I-MAC_ADDRESS",
|
| 358 |
+
"L-MAC_ADDRESS",
|
| 359 |
+
"U-MAC_ADDRESS",
|
| 360 |
+
|
| 361 |
+
"B-AGE",
|
| 362 |
+
"I-AGE",
|
| 363 |
+
"L-AGE",
|
| 364 |
+
"U-AGE",
|
| 365 |
+
]
|
| 366 |
+
)
|
| 367 |
+
),
|
| 368 |
+
"tokens": datasets.Sequence(datasets.Value("string")),
|
| 369 |
+
"template_id": datasets.Value("int32"),
|
| 370 |
+
"metadata": datasets.Value("int32"),
|
| 371 |
+
}
|
| 372 |
+
)
|
| 373 |
+
|
| 374 |
+
return datasets.DatasetInfo(
|
| 375 |
+
description=_DESCRIPTION,
|
| 376 |
+
features=features,
|
| 377 |
+
# supervised_keys=("sentence", "label"),
|
| 378 |
+
# Homepage of the dataset for documentation
|
| 379 |
+
homepage=_HOMEPAGE,
|
| 380 |
+
# License for the dataset if available
|
| 381 |
+
license=_LICENSE,
|
| 382 |
+
# Citation for the dataset
|
| 383 |
+
citation=_CITATION,
|
| 384 |
+
)
|
| 385 |
+
|
| 386 |
+
def _split_generators(self, dl_manager):
|
| 387 |
+
data_dir = dl_manager.download_and_extract(_URL)
|
| 388 |
+
size = "small"
|
| 389 |
+
if self.config.name == "large": # This is the name of the configuration selected in BUILDER_CONFIGS above
|
| 390 |
+
size = "large"
|
| 391 |
+
return [
|
| 392 |
+
datasets.SplitGenerator(
|
| 393 |
+
name=datasets.Split.TRAIN,
|
| 394 |
+
# These kwargs will be passed to _generate_examples
|
| 395 |
+
gen_kwargs={
|
| 396 |
+
"filepath": os.path.join(data_dir, f"train-{size}.json"),
|
| 397 |
+
"split": "train",
|
| 398 |
+
},
|
| 399 |
+
),
|
| 400 |
+
datasets.SplitGenerator(
|
| 401 |
+
name=datasets.Split.VALIDATION,
|
| 402 |
+
# These kwargs will be passed to _generate_examples
|
| 403 |
+
gen_kwargs={
|
| 404 |
+
"filepath": os.path.join(data_dir, f"dev-{size}.json"),
|
| 405 |
+
"split": "dev",
|
| 406 |
+
},
|
| 407 |
+
),
|
| 408 |
+
datasets.SplitGenerator(
|
| 409 |
+
name=datasets.Split.TEST,
|
| 410 |
+
# These kwargs will be passed to _generate_examples
|
| 411 |
+
gen_kwargs={
|
| 412 |
+
"filepath": os.path.join(data_dir, f"test-{size}.json"),
|
| 413 |
+
"split": "test"
|
| 414 |
+
},
|
| 415 |
+
),
|
| 416 |
+
]
|
| 417 |
+
|
| 418 |
+
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 419 |
+
def _generate_examples(self, filepath, split):
|
| 420 |
+
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
| 421 |
+
with open(filepath, encoding="utf-8") as f:
|
| 422 |
+
dataset = json.load(f)
|
| 423 |
+
for key, row in enumerate(dataset):
|
| 424 |
+
# Yields examples as (key, example) tuples
|
| 425 |
+
yield key, {
|
| 426 |
+
"tokens": row["tokens"],
|
| 427 |
+
"tags": row["tags"],
|
| 428 |
+
"full_text": row["full_text"],
|
| 429 |
+
"spans": row["spans"],
|
| 430 |
+
"masked": row["masked"],
|
| 431 |
+
"template_id": row["template_id"],
|
| 432 |
+
"metadata": row["metadata"],
|
| 433 |
+
}
|