birgermoell's picture
Upload README.md with huggingface_hub
6eeb4d6 verified
metadata
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.

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

{
    "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

from datasets import load_dataset

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

Filtering by Complexity

# 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

# 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:

@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

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