birgermoell commited on
Commit
6eeb4d6
·
verified ·
1 Parent(s): 3f2ed10

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +188 -0
README.md ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-sa-4.0
3
+ language:
4
+ - sv
5
+ tags:
6
+ - readability
7
+ - text-complexity
8
+ - swedish
9
+ - lix
10
+ - linguistics
11
+ - nlp
12
+ task_categories:
13
+ - text-classification
14
+ - text-generation
15
+ pretty_name: Swedish Text Complexity
16
+ size_categories:
17
+ - 1K<n<10K
18
+ ---
19
+
20
+ # Swedish Text Complexity Dataset
21
+
22
+ A corpus of Swedish texts annotated with readability and linguistic complexity metrics, created by the [Department of Linguistics and Philology at Uppsala University](https://www.uu.se/en/department/linguistics-and-philology).
23
+
24
+ ## Dataset Description
25
+
26
+ This dataset contains Swedish text passages annotated with multiple complexity metrics, designed to support research in:
27
+
28
+ - **Controllable text generation** - Train LLMs to generate text at specific reading levels
29
+ - **Educational NLP** - Match texts to student reading proficiency
30
+ - **Text simplification** - Develop automatic simplification systems
31
+ - **Accessibility research** - Create tools for readers with different needs
32
+ - **Readability research** - Study linguistic factors affecting comprehension
33
+
34
+ ## Metrics Included
35
+
36
+ | Metric | Description | Range |
37
+ |--------|-------------|-------|
38
+ | **LIX** | Läsbarhetsindex (Swedish readability index) | ~20-70+ |
39
+ | **OVIX** | Ordvariationsindex (lexical variation) | Higher = more varied vocabulary |
40
+ | **Nominal Ratio** | Noun/verb density ratio | Higher = more nominal style |
41
+ | **ASL** | Average Sentence Length | words per sentence |
42
+ | **AWL** | Average Word Length | characters per word |
43
+ | **LW%** | Long Word Percentage | % of words >6 characters |
44
+ | **TTR** | Type-Token Ratio | 0-1 (lexical diversity) |
45
+
46
+ ### LIX Score Interpretation
47
+
48
+ | Score | Category | Typical Examples |
49
+ |-------|----------|------------------|
50
+ | < 25 | Very Easy | Children's books |
51
+ | 25-30 | Easy | Young adult fiction |
52
+ | 30-40 | Medium | Newspapers, popular fiction |
53
+ | 40-50 | Difficult | Official documents, non-fiction |
54
+ | 50-60 | Very Difficult | Academic texts |
55
+ | > 60 | Extremely Difficult | Legal, specialized academic |
56
+
57
+ ## Dataset Structure
58
+
59
+ ```python
60
+ {
61
+ "id": "wikipedia_sv-a1b2c3d4",
62
+ "text": "Stockholms tunnelbana öppnades 1950...",
63
+ "source": "wikipedia_sv",
64
+ "genre": "encyclopedia",
65
+ "year": null,
66
+ "author": "Wikipedia contributors",
67
+ "license": "CC-BY-SA-4.0",
68
+ "metrics_num_sentences": 5,
69
+ "metrics_num_words": 87,
70
+ "metrics_num_characters": 523,
71
+ "metrics_num_long_words": 24,
72
+ "metrics_num_unique_words": 71,
73
+ "metrics_lix": 42.6,
74
+ "metrics_lix_category": "difficult",
75
+ "metrics_ovix": 78.3,
76
+ "metrics_nominal_ratio": 1.45,
77
+ "metrics_avg_sentence_length": 17.4,
78
+ "metrics_avg_word_length": 6.01,
79
+ "metrics_long_word_pct": 27.6,
80
+ "metrics_type_token_ratio": 0.816
81
+ }
82
+ ```
83
+
84
+ ## Usage
85
+
86
+ ### Loading the Dataset
87
+
88
+ ```python
89
+ from datasets import load_dataset
90
+
91
+ dataset = load_dataset("LingFilUU/swedish-text-complexity")
92
+ ```
93
+
94
+ ### Filtering by Complexity
95
+
96
+ ```python
97
+ # Get only easy texts (LIX < 30)
98
+ easy_texts = dataset.filter(lambda x: x["metrics_lix"] < 30)
99
+
100
+ # Get difficult academic-style texts
101
+ difficult = dataset.filter(
102
+ lambda x: x["metrics_lix"] > 50 and x["metrics_nominal_ratio"] > 1.5
103
+ )
104
+ ```
105
+
106
+ ### Training for Controllable Generation
107
+
108
+ ```python
109
+ # Add complexity labels for conditional generation
110
+ def add_complexity_token(example):
111
+ lix = example["metrics_lix"]
112
+ if lix < 30:
113
+ prefix = "<easy>"
114
+ elif lix < 45:
115
+ prefix = "<medium>"
116
+ else:
117
+ prefix = "<difficult>"
118
+ example["text_with_prefix"] = f"{prefix} {example['text']}"
119
+ return example
120
+
121
+ dataset = dataset.map(add_complexity_token)
122
+ ```
123
+
124
+ ## Data Sources
125
+
126
+ Texts in this dataset are sourced from openly-licensed Swedish corpora:
127
+
128
+ - **Swedish Wikipedia** (CC-BY-SA-4.0)
129
+ - **Språkbanken resources** (various open licenses)
130
+ - **Project Runeberg** (public domain)
131
+
132
+ ## Methodology
133
+
134
+ ### LIX Calculation
135
+
136
+ The LIX (Läsbarhetsindex) formula, developed by Carl-Hugo Björnsson (1968):
137
+
138
+ ```
139
+ LIX = (words / sentences) + (long_words × 100 / words)
140
+ ```
141
+
142
+ Where `long_words` = words with more than 6 characters.
143
+
144
+ ### OVIX Calculation
145
+
146
+ The OVIX (Ordvariationsindex) formula:
147
+
148
+ ```
149
+ OVIX = log(tokens) / log(2 - log(types) / log(tokens))
150
+ ```
151
+
152
+ ### Nominal Ratio
153
+
154
+ Calculated using spaCy's Swedish POS tagger:
155
+
156
+ ```
157
+ NR = (nouns + prepositions + participles) / (verbs + adverbs + pronouns)
158
+ ```
159
+
160
+ ## Citation
161
+
162
+ If you use this dataset, please cite:
163
+
164
+ ```bibtex
165
+ @dataset{lingfiluu_swedish_text_complexity,
166
+ author = {Department of Linguistics and Philology, Uppsala University},
167
+ title = {Swedish Text Complexity Dataset},
168
+ year = {2025},
169
+ publisher = {Hugging Face},
170
+ url = {https://huggingface.co/datasets/LingFilUU/swedish-text-complexity}
171
+ }
172
+ ```
173
+
174
+ ## References
175
+
176
+ - Björnsson, C.H. (1968). *Läsbarhet*. Stockholm: Liber.
177
+ - Hultman, T.G., & Westman, M. (1977). *Gymnasistsvenska*. Lund: Liber Läromedel.
178
+ - [Språkbanken Text](https://spraakbanken.gu.se/en)
179
+
180
+ ## License
181
+
182
+ The dataset compilation is released under CC-BY-SA-4.0. Individual texts retain their original licenses as noted in the `license` field.
183
+
184
+ ## Contact
185
+
186
+ Department of Linguistics and Philology
187
+ Uppsala University
188
+ https://www.uu.se/en/department/linguistics-and-philology