Upload README.md with huggingface_hub
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188---license: cc-by-sa-4.0language:- svtags:- readability- text-complexity- swedish- lix- linguistics- nlptask_categories:- text-classification- text-generationpretty_name: Swedish Text Complexitysize_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
```pythonfrom 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 textsdifficult = 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 generationdef 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 PhilologyUppsala Universityhttps://www.uu.se/en/department/linguistics-and-philologyREADME.mdAdded+188