File size: 5,152 Bytes
6eeb4d6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
---
license: cc-by-sa-4.0
language:
- sv
tags:
- readability
- text-complexity
- swedish
- lix
- linguistics
- nlp
task_categories:
- text-classification
- text-generation
pretty_name: Swedish Text Complexity
size_categories:
- 1K<n<10K
---

# Swedish Text Complexity Dataset

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).

## Dataset Description

This dataset contains Swedish text passages annotated with multiple complexity metrics, designed to support research in:

- **Controllable text generation** - Train LLMs to generate text at specific reading levels
- **Educational NLP** - Match texts to student reading proficiency
- **Text simplification** - Develop automatic simplification systems
- **Accessibility research** - Create tools for readers with different needs
- **Readability research** - Study linguistic factors affecting comprehension

## Metrics Included

| Metric | Description | Range |
|--------|-------------|-------|
| **LIX** | Läsbarhetsindex (Swedish readability index) | ~20-70+ |
| **OVIX** | Ordvariationsindex (lexical variation) | Higher = more varied vocabulary |
| **Nominal Ratio** | Noun/verb density ratio | Higher = more nominal style |
| **ASL** | Average Sentence Length | words per sentence |
| **AWL** | Average Word Length | characters per word |
| **LW%** | Long Word Percentage | % of words >6 characters |
| **TTR** | Type-Token Ratio | 0-1 (lexical diversity) |

### LIX Score Interpretation

| Score | Category | Typical Examples |
|-------|----------|------------------|
| < 25 | Very Easy | Children's books |
| 25-30 | Easy | Young adult fiction |
| 30-40 | Medium | Newspapers, popular fiction |
| 40-50 | Difficult | Official documents, non-fiction |
| 50-60 | Very Difficult | Academic texts |
| > 60 | Extremely Difficult | Legal, specialized academic |

## Dataset Structure

```python
{
    "id": "wikipedia_sv-a1b2c3d4",
    "text": "Stockholms tunnelbana öppnades 1950...",
    "source": "wikipedia_sv",
    "genre": "encyclopedia",
    "year": null,
    "author": "Wikipedia contributors",
    "license": "CC-BY-SA-4.0",
    "metrics_num_sentences": 5,
    "metrics_num_words": 87,
    "metrics_num_characters": 523,
    "metrics_num_long_words": 24,
    "metrics_num_unique_words": 71,
    "metrics_lix": 42.6,
    "metrics_lix_category": "difficult",
    "metrics_ovix": 78.3,
    "metrics_nominal_ratio": 1.45,
    "metrics_avg_sentence_length": 17.4,
    "metrics_avg_word_length": 6.01,
    "metrics_long_word_pct": 27.6,
    "metrics_type_token_ratio": 0.816
}
```

## Usage

### Loading the Dataset

```python
from datasets import load_dataset

dataset = load_dataset("LingFilUU/swedish-text-complexity")
```

### Filtering by Complexity

```python
# Get only easy texts (LIX < 30)
easy_texts = dataset.filter(lambda x: x["metrics_lix"] < 30)

# Get difficult academic-style texts
difficult = dataset.filter(
    lambda x: x["metrics_lix"] > 50 and x["metrics_nominal_ratio"] > 1.5
)
```

### Training for Controllable Generation

```python
# Add complexity labels for conditional generation
def add_complexity_token(example):
    lix = example["metrics_lix"]
    if lix < 30:
        prefix = "<easy>"
    elif lix < 45:
        prefix = "<medium>"
    else:
        prefix = "<difficult>"
    example["text_with_prefix"] = f"{prefix} {example['text']}"
    return example

dataset = dataset.map(add_complexity_token)
```

## Data Sources

Texts in this dataset are sourced from openly-licensed Swedish corpora:

- **Swedish Wikipedia** (CC-BY-SA-4.0)
- **Språkbanken resources** (various open licenses)
- **Project Runeberg** (public domain)

## Methodology

### LIX Calculation

The LIX (Läsbarhetsindex) formula, developed by Carl-Hugo Björnsson (1968):

```
LIX = (words / sentences) + (long_words × 100 / words)
```

Where `long_words` = words with more than 6 characters.

### OVIX Calculation

The OVIX (Ordvariationsindex) formula:

```
OVIX = log(tokens) / log(2 - log(types) / log(tokens))
```

### Nominal Ratio

Calculated using spaCy's Swedish POS tagger:

```
NR = (nouns + prepositions + participles) / (verbs + adverbs + pronouns)
```

## Citation

If you use this dataset, please cite:

```bibtex
@dataset{lingfiluu_swedish_text_complexity,
  author = {Department of Linguistics and Philology, Uppsala University},
  title = {Swedish Text Complexity Dataset},
  year = {2025},
  publisher = {Hugging Face},
  url = {https://huggingface.co/datasets/LingFilUU/swedish-text-complexity}
}
```

## References

- Björnsson, C.H. (1968). *Läsbarhet*. Stockholm: Liber.
- Hultman, T.G., & Westman, M. (1977). *Gymnasistsvenska*. Lund: Liber Läromedel.
- [Språkbanken Text](https://spraakbanken.gu.se/en)

## License

The dataset compilation is released under CC-BY-SA-4.0. Individual texts retain their original licenses as noted in the `license` field.

## Contact

Department of Linguistics and Philology
Uppsala University
https://www.uu.se/en/department/linguistics-and-philology