Datasets:

Modalities:
Text
Formats:
json
Languages:
English
Size:
< 1K
DOI:
Libraries:
Datasets
pandas
License:
Programmer-RD-AI commited on
Commit
f8817e0
·
verified ·
1 Parent(s): 035dc41

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +75 -1
README.md CHANGED
@@ -4,4 +4,78 @@ language:
4
  - en
5
  size_categories:
6
  - n<1K
7
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  - en
5
  size_categories:
6
  - n<1K
7
+ ---
8
+
9
+ ## sfia-9-chunks Dataset
10
+
11
+ ### Overview
12
+
13
+ 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.
14
+
15
+ ### Chunking Methodology
16
+
17
+ We employ the following procedure to generate chunks:
18
+
19
+ ```python
20
+ from sentence_transformers import SentenceTransformer
21
+ from sklearn.cluster import AgglomerativeClustering
22
+
23
+ MODEL_NAME = "all-MiniLM-L12-v2"
24
+
25
+ def get_chunks(document: str) -> list[str]:
26
+ model = SentenceTransformer(MODEL_NAME)
27
+ sentences = document.split(". ")
28
+ embs = model.encode(sentences)
29
+ clustering = AgglomerativeClustering(n_clusters=None, distance_threshold=1.0).fit(
30
+ embs
31
+ )
32
+ chunks = []
33
+ for label in set(clustering.labels_):
34
+ group = [
35
+ sentences[i]
36
+ for i in range(len(sentences))
37
+ if clustering.labels_[i] == label
38
+ ]
39
+ chunks.append(". ".join(group))
40
+ return chunks
41
+ ```
42
+
43
+ * **Model:** `all-MiniLM-L12-v2` for efficient sentence embeddings.
44
+ * **Clustering:** Agglomerative clustering with a distance threshold of `1.0` to dynamically determine the number of semantic groups.
45
+
46
+ ### Dataset Structure
47
+
48
+ 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:
49
+
50
+ * `chunks` (`string`): One coherent semantic chunk extracted via hierarchical clustering.
51
+
52
+ ### Usage Example
53
+
54
+ ```python
55
+ from datasets import load_dataset
56
+
57
+ dataset = load_dataset("Programmer-RD-AI/sfia-9-chunks")
58
+
59
+ for example in dataset:
60
+ print(example["chunks"])
61
+ ```
62
+
63
+ ### License
64
+
65
+ This dataset is released under the Creative Commons Attribution 4.0 International (CC BY 4.0) license.
66
+ You can view the full license at: [https://creativecommons.org/licenses/by/4.0/](https://creativecommons.org/licenses/by/4.0/)
67
+
68
+ ### Citation
69
+
70
+ If you use this dataset in your research, please cite:
71
+
72
+ ```bibtex
73
+ @misc{ranuga_disansa_gamage_2025,
74
+ author = {Ranuga Disansa Gamage},
75
+ title = {sfia-9-chunks (Revision 035dc41)},
76
+ year = 2025,
77
+ url = {https://huggingface.co/datasets/Programmer-RD-AI/sfia-9-chunks},
78
+ doi = {10.57967/hf/5747},
79
+ publisher = {Hugging Face}
80
+ }
81
+ ```