--- 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: - 1K6 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 = "" elif lix < 45: prefix = "" else: prefix = "" 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