Datasets:

cs489-f26-a3 / README.md
ExplorerFreda's picture
feat: publish CS 489 F26 A3 constituent-label train and dev data
e7a73ab verified
|
Raw History Blame Contribute Delete
3.12 kB
---
pretty_name: CS 489 F26 A3 Constituent Labels
language:
- en
tags:
- constituent-labeling
- representation-probing
- cs489
size_categories:
- 10K<n<100K
configs:
- config_name: default
data_files:
- split: train
path: train.parquet
- split: dev
path: dev.parquet
---
# A3 constituent-label data
English sentences with labeled constituent spans for CS 489 Assignment 3 at the University of Waterloo (Fall 2026).
Each example provides word tokens and gold span boundaries; the assignment predicts the constituent label of each span using frozen BERT representations.
Dataset: [compling/cs489-f26-a3](https://huggingface.co/datasets/compling/cs489-f26-a3).
Collection: [cs489-f26](https://huggingface.co/collections/compling/cs489-f26).
| Split | Sentences | Labeled spans |
| :--- | ---: | ---: |
| `train` | 39,832 | 701,738 |
| `dev` | 1,700 | 29,034 |
The label vocabulary contains 26 constituent labels.
The TA holds a separate test split for final evaluation.
## Load with Hugging Face Datasets
```python
from datasets import load_dataset
corpus = load_dataset("compling/cs489-f26-a3")
train = corpus["train"]
dev = corpus["dev"]
sentence = train[0]
tokens = sentence["tokens"]
spans = sentence["constituents"]
```
## Download the assignment files
The starter reads the original JSONL files and label list from `data/`.
Run this from the starter project root:
```python
from huggingface_hub import snapshot_download
snapshot_download(
repo_id="compling/cs489-f26-a3",
repo_type="dataset",
allow_patterns=["train.jsonl", "dev.jsonl", "labels.json", "manifest.json"],
local_dir="data",
)
```
## Sentence format
Each UTF-8 JSONL line is one sentence with three fields:
- `id`: a unique string identifier for the record.
- `tokens`: the ordered list of word tokens, preserving capitalization and punctuation.
- `constituents`: a list of objects with integer `start` and `end` fields and a string `label`.
A hand-written example:
```json
{"id":"toy-0001","tokens":["The","cat","sleeps","."],"constituents":[{"start":0,"end":2,"label":"NP"},{"start":0,"end":4,"label":"S"},{"start":2,"end":3,"label":"VP"}]}
```
Boundaries use zero-based word-token indices with an exclusive end: `tokens[start:end]`.
They satisfy `0 <= start < end <= len(tokens)`.
Each span has one label, and the spans are sorted by `(start, end)` with unique boundary pairs within each sentence.
`labels.json` is a JSON list of 26 label strings.
A label's zero-based index in this list is its class ID.
Use the supplied order for every split, probe, and saved artifact.
Use the complete train/dev files as supplied and count every listed span during training and evaluation.
## Files
| File | Contents |
| :--- | :--- |
| `train.jsonl`, `dev.jsonl` | Sentence records in the format above, one record per line |
| `labels.json` | Ordered label vocabulary |
| `manifest.json` | Dataset metadata, counts, and SHA-256 checksums for the assignment files |
| `train.parquet`, `dev.parquet` | Equivalent typed tables used by `load_dataset`, preserving every field and row |