Datasets:

Modalities:
Text
Formats:
json
Languages:
English
Size:
< 1K
DOI:
Libraries:
Datasets
pandas
License:
File size: 2,530 Bytes
035dc41
 
 
 
 
 
f8817e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
license: cc-by-nc-4.0
language:
- en
size_categories:
- n<1K
---

## sfia-9-chunks Dataset

### Overview

The `sfia-9-chunks` dataset is a derived dataset from [`sfia-9-scraped`](https://huggingface.co/datasets/Programmer-RD-AI/sfia-9-scraped). It uses sentence embeddings and hierarchical clustering to split each SFIA-9 document into coherent semantic chunks. This chunking facilitates more efficient downstream tasks like semantic search, question answering, and topic modeling.

### Chunking Methodology

We employ the following procedure to generate chunks:

```python
from sentence_transformers import SentenceTransformer
from sklearn.cluster import AgglomerativeClustering

MODEL_NAME = "all-MiniLM-L12-v2"

def get_chunks(document: str) -> list[str]:
    model = SentenceTransformer(MODEL_NAME)
    sentences = document.split(". ")
    embs = model.encode(sentences)
    clustering = AgglomerativeClustering(n_clusters=None, distance_threshold=1.0).fit(
        embs
    )
    chunks = []
    for label in set(clustering.labels_):
        group = [
            sentences[i]
            for i in range(len(sentences))
            if clustering.labels_[i] == label
        ]
        chunks.append(". ".join(group))
    return chunks
```

* **Model:** `all-MiniLM-L12-v2` for efficient sentence embeddings.
* **Clustering:** Agglomerative clustering with a distance threshold of `1.0` to dynamically determine the number of semantic groups.

### Dataset Structure

This dataset consists of a flat list of semantic text chunks derived from the SFIA-9 documents. When loaded, each example is an object with a single field:

* `chunks` (`string`): One coherent semantic chunk extracted via hierarchical clustering.

### Usage Example

```python
from datasets import load_dataset

dataset = load_dataset("Programmer-RD-AI/sfia-9-chunks")

for example in dataset:
    print(example["chunks"])
```

### License

This dataset is released under the Creative Commons Attribution 4.0 International (CC BY 4.0) license.
You can view the full license at: [https://creativecommons.org/licenses/by/4.0/](https://creativecommons.org/licenses/by/4.0/)

### Citation

If you use this dataset in your research, please cite:

```bibtex
@misc{ranuga_disansa_gamage_2025,
	author       = {Ranuga Disansa Gamage},
	title        = {sfia-9-chunks (Revision 035dc41)},
	year         = 2025,
	url          = {https://huggingface.co/datasets/Programmer-RD-AI/sfia-9-chunks},
	doi          = {10.57967/hf/5747},
	publisher    = {Hugging Face}
}
```