Datasets:
Kenneth commited on
Commit ·
8cfa466
1
Parent(s): 264ae6f
Added 11 `flashback-*` subsets from the Flashback internet forum.
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- CHANGELOG.md +6 -0
- README.md +45 -1
- data/flashback-dator/create.py +144 -0
- data/flashback-dator/descriptive_stats.json +9 -0
- data/flashback-dator/flashback-dator.log +0 -0
- data/flashback-dator/flashback-dator.md +107 -0
- data/flashback-dator/flashback-dator.parquet +3 -0
- data/flashback-dator/images/dist_document_length.png +3 -0
- data/flashback-droger/create.py +134 -0
- data/flashback-droger/descriptive_stats.json +9 -0
- data/flashback-droger/flashback-droger.md +95 -0
- data/flashback-droger/flashback-droger.parquet +3 -0
- data/flashback-droger/images/dist_document_length.png +3 -0
- data/flashback-ekonomi/create.py +134 -0
- data/flashback-ekonomi/descriptive_stats.json +9 -0
- data/flashback-ekonomi/flashback-ekonomi.md +95 -0
- data/flashback-ekonomi/flashback-ekonomi.parquet +3 -0
- data/flashback-ekonomi/images/dist_document_length.png +3 -0
- data/flashback-hem/create.py +134 -0
- data/flashback-hem/descriptive_stats.json +9 -0
- data/flashback-hem/flashback-hem.md +95 -0
- data/flashback-hem/flashback-hem.parquet +3 -0
- data/flashback-hem/images/dist_document_length.png +3 -0
- data/flashback-kultur/create.py +134 -0
- data/flashback-kultur/descriptive_stats.json +9 -0
- data/flashback-kultur/flashback-kultur.md +95 -0
- data/flashback-kultur/flashback-kultur.parquet +3 -0
- data/flashback-kultur/images/dist_document_length.png +3 -0
- data/flashback-livsstil/create.py +134 -0
- data/flashback-livsstil/descriptive_stats.json +9 -0
- data/flashback-livsstil/flashback-livsstil.md +95 -0
- data/flashback-livsstil/flashback-livsstil.parquet +3 -0
- data/flashback-livsstil/images/dist_document_length.png +3 -0
- data/flashback-ovrigt/create.py +134 -0
- data/flashback-ovrigt/descriptive_stats.json +9 -0
- data/flashback-ovrigt/flashback-ovrigt.md +95 -0
- data/flashback-ovrigt/flashback-ovrigt.parquet +3 -0
- data/flashback-ovrigt/images/dist_document_length.png +3 -0
- data/flashback-politik/create.py +134 -0
- data/flashback-politik/descriptive_stats.json +9 -0
- data/flashback-politik/flashback-politik.md +95 -0
- data/flashback-politik/flashback-politik.parquet +3 -0
- data/flashback-politik/images/dist_document_length.png +3 -0
- data/flashback-samhalle/create.py +134 -0
- data/flashback-samhalle/descriptive_stats.json +9 -0
- data/flashback-samhalle/flashback-samhalle.md +95 -0
- data/flashback-samhalle/flashback-samhalle.parquet +3 -0
- data/flashback-samhalle/images/dist_document_length.png +3 -0
- data/flashback-sport/create.py +134 -0
- data/flashback-sport/descriptive_stats.json +9 -0
CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
| 5 |
|
| 6 |
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
## [v0.0.7] - 2026-06-21
|
| 9 |
|
| 10 |
### Added
|
|
|
|
| 5 |
|
| 6 |
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
| 7 |
|
| 8 |
+
## [v0.0.10] - 2026-07-26
|
| 9 |
+
|
| 10 |
+
### Added
|
| 11 |
+
|
| 12 |
+
- Added 11 `flashback-*` subsets from the Flashback internet forum: `flashback-dator`, `flashback-droger`, `flashback-ekonomi`, `flashback-hem`, `flashback-kultur`, `flashback-livsstil`, `flashback-ovrigt`, `flashback-politik`, `flashback-samhalle`, `flashback-sport`, `flashback-vetenskap`.
|
| 13 |
+
|
| 14 |
## [v0.0.7] - 2026-06-21
|
| 15 |
|
| 16 |
### Added
|
README.md
CHANGED
|
@@ -89,6 +89,50 @@ configs:
|
|
| 89 |
data_files:
|
| 90 |
- split: train
|
| 91 |
path: data/cellar/*.parquet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
language_bcp47:
|
| 93 |
- swe
|
| 94 |
---
|
|
@@ -99,7 +143,7 @@ language_bcp47:
|
|
| 99 |
<!-- START README TABLE -->
|
| 100 |
| | |
|
| 101 |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| 102 |
-
| **Version** | 0.0.
|
| 103 |
| **Language** | Swedish (sv, swe) |
|
| 104 |
| **License** | Openly Licensed, See the respective dataset |
|
| 105 |
| **Models** | Currently there is no models trained on this dataset |
|
|
|
|
| 89 |
data_files:
|
| 90 |
- split: train
|
| 91 |
path: data/cellar/*.parquet
|
| 92 |
+
- config_name: flashback-dator
|
| 93 |
+
data_files:
|
| 94 |
+
- split: train
|
| 95 |
+
path: data/flashback-dator/*.parquet
|
| 96 |
+
- config_name: flashback-droger
|
| 97 |
+
data_files:
|
| 98 |
+
- split: train
|
| 99 |
+
path: data/flashback-droger/*.parquet
|
| 100 |
+
- config_name: flashback-ekonomi
|
| 101 |
+
data_files:
|
| 102 |
+
- split: train
|
| 103 |
+
path: data/flashback-ekonomi/*.parquet
|
| 104 |
+
- config_name: flashback-hem
|
| 105 |
+
data_files:
|
| 106 |
+
- split: train
|
| 107 |
+
path: data/flashback-hem/*.parquet
|
| 108 |
+
- config_name: flashback-kultur
|
| 109 |
+
data_files:
|
| 110 |
+
- split: train
|
| 111 |
+
path: data/flashback-kultur/*.parquet
|
| 112 |
+
- config_name: flashback-livsstil
|
| 113 |
+
data_files:
|
| 114 |
+
- split: train
|
| 115 |
+
path: data/flashback-livsstil/*.parquet
|
| 116 |
+
- config_name: flashback-ovrigt
|
| 117 |
+
data_files:
|
| 118 |
+
- split: train
|
| 119 |
+
path: data/flashback-ovrigt/*.parquet
|
| 120 |
+
- config_name: flashback-politik
|
| 121 |
+
data_files:
|
| 122 |
+
- split: train
|
| 123 |
+
path: data/flashback-politik/*.parquet
|
| 124 |
+
- config_name: flashback-samhalle
|
| 125 |
+
data_files:
|
| 126 |
+
- split: train
|
| 127 |
+
path: data/flashback-samhalle/*.parquet
|
| 128 |
+
- config_name: flashback-sport
|
| 129 |
+
data_files:
|
| 130 |
+
- split: train
|
| 131 |
+
path: data/flashback-sport/*.parquet
|
| 132 |
+
- config_name: flashback-vetenskap
|
| 133 |
+
data_files:
|
| 134 |
+
- split: train
|
| 135 |
+
path: data/flashback-vetenskap/*.parquet
|
| 136 |
language_bcp47:
|
| 137 |
- swe
|
| 138 |
---
|
|
|
|
| 143 |
<!-- START README TABLE -->
|
| 144 |
| | |
|
| 145 |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| 146 |
+
| **Version** | 0.0.10 ([Changelog](/CHANGELOG.md)) |
|
| 147 |
| **Language** | Swedish (sv, swe) |
|
| 148 |
| **License** | Openly Licensed, See the respective dataset |
|
| 149 |
| **Models** | Currently there is no models trained on this dataset |
|
data/flashback-dator/create.py
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /// script
|
| 2 |
+
# requires-python = ">=3.12"
|
| 3 |
+
# dependencies = [
|
| 4 |
+
# "datasets>=3.0.0",
|
| 5 |
+
# "dynaword",
|
| 6 |
+
# "pydantic>=2.10.4",
|
| 7 |
+
# "transformers>=4.47.1",
|
| 8 |
+
# ]
|
| 9 |
+
#
|
| 10 |
+
# [tool.uv.sources]
|
| 11 |
+
# dynaword = { path = "../.." }
|
| 12 |
+
# ///
|
| 13 |
+
|
| 14 |
+
"""Download and process Språkbanken Text's `flashback-dator` corpus.
|
| 15 |
+
|
| 16 |
+
The source corpus has sentences scrambled for copyright/privacy reasons.
|
| 17 |
+
Each sentence is emitted as a separate document.
|
| 18 |
+
|
| 19 |
+
To run this script, set GIT_LFS_SKIP_SMUDGE=1 so uv does not download large
|
| 20 |
+
Git LFS files while resolving the local Dynaword environment:
|
| 21 |
+
|
| 22 |
+
GIT_LFS_SKIP_SMUDGE=1 uv run data/flashback-dator/create.py
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
import bz2
|
| 26 |
+
import logging
|
| 27 |
+
import urllib.request
|
| 28 |
+
import xml.etree.ElementTree as ET
|
| 29 |
+
from datetime import date
|
| 30 |
+
from pathlib import Path
|
| 31 |
+
|
| 32 |
+
import datasets
|
| 33 |
+
from datasets import Dataset
|
| 34 |
+
from dynaword.process_dataset import (
|
| 35 |
+
add_token_count,
|
| 36 |
+
ensure_column_order,
|
| 37 |
+
remove_duplicate_text,
|
| 38 |
+
remove_empty_texts,
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
logger = logging.getLogger(__name__)
|
| 42 |
+
|
| 43 |
+
SOURCE = "flashback-dator"
|
| 44 |
+
XML_URL = "https://spraakbanken.gu.se/resurser/meningsmangder/flashback-dator.xml.bz2"
|
| 45 |
+
CACHE_FILE = Path(__file__).parent / "cache" / "flashback-dator.xml.bz2"
|
| 46 |
+
|
| 47 |
+
NO_SPACE_BEFORE = (".", ",", ";", ":", "!", "?", ")", "]", "}", "»")
|
| 48 |
+
NO_SPACE_AFTER = ("(", "[", "{", "«")
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def download_if_needed(url: str, path: Path) -> None:
|
| 52 |
+
if path.exists():
|
| 53 |
+
logger.info("Using cached %s", path)
|
| 54 |
+
return
|
| 55 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 56 |
+
logger.info("Downloading %s to %s", url, path)
|
| 57 |
+
urllib.request.urlretrieve(url, path)
|
| 58 |
+
logger.info("Download complete")
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def format_date(value: str) -> str:
|
| 62 |
+
return f"{value[:4]}-{value[4:6]}-{value[6:8]}"
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def detokenize(tokens: list[str]) -> str:
|
| 66 |
+
text = " ".join(t.strip() for t in tokens if t and t.strip())
|
| 67 |
+
for token in NO_SPACE_BEFORE:
|
| 68 |
+
text = text.replace(f" {token}", token)
|
| 69 |
+
for token in NO_SPACE_AFTER:
|
| 70 |
+
text = text.replace(f"{token} ", token)
|
| 71 |
+
return " ".join(text.split()).strip()
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def sentence_text(sentence: ET.Element) -> str:
|
| 75 |
+
tokens = [(t.text or "") for t in sentence.iter("token")]
|
| 76 |
+
return detokenize(tokens)
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def iter_sentences(bz2_path: Path):
|
| 80 |
+
"""Yield one record per sentence. Sentences are scrambled in the source corpus."""
|
| 81 |
+
current_created = ""
|
| 82 |
+
index = 0
|
| 83 |
+
today = date.today().strftime("%Y-%m-%d")
|
| 84 |
+
with bz2.open(bz2_path, "rb") as f:
|
| 85 |
+
parent_stack: list[ET.Element] = []
|
| 86 |
+
for event, elem in ET.iterparse(f, events=("start", "end")):
|
| 87 |
+
if event == "start":
|
| 88 |
+
parent_stack.append(elem)
|
| 89 |
+
if elem.tag == "text":
|
| 90 |
+
datefrom = elem.attrib.get("datefrom", "")
|
| 91 |
+
dateto = elem.attrib.get("dateto", "")
|
| 92 |
+
current_created = (
|
| 93 |
+
f"{format_date(datefrom)}, {format_date(dateto)}"
|
| 94 |
+
if datefrom and dateto
|
| 95 |
+
else ""
|
| 96 |
+
)
|
| 97 |
+
else:
|
| 98 |
+
if elem.tag == "sentence":
|
| 99 |
+
text = sentence_text(elem)
|
| 100 |
+
if text:
|
| 101 |
+
index += 1
|
| 102 |
+
yield {
|
| 103 |
+
"id": f"{SOURCE}_{index:08d}",
|
| 104 |
+
"text": text,
|
| 105 |
+
"source": SOURCE,
|
| 106 |
+
"added": today,
|
| 107 |
+
"created": current_created,
|
| 108 |
+
}
|
| 109 |
+
if len(parent_stack) >= 2:
|
| 110 |
+
parent_stack[-2].remove(elem)
|
| 111 |
+
elem.clear()
|
| 112 |
+
elif elem.tag in ("text", "paragraph"):
|
| 113 |
+
if len(parent_stack) >= 2:
|
| 114 |
+
parent_stack[-2].remove(elem)
|
| 115 |
+
elem.clear()
|
| 116 |
+
parent_stack.pop()
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def build_dataset(bz2_path: Path) -> Dataset:
|
| 120 |
+
datasets.disable_caching()
|
| 121 |
+
dataset = Dataset.from_generator(lambda: iter_sentences(bz2_path))
|
| 122 |
+
dataset = remove_empty_texts(dataset)
|
| 123 |
+
dataset = remove_duplicate_text(dataset)
|
| 124 |
+
dataset = add_token_count(dataset)
|
| 125 |
+
dataset = ensure_column_order(dataset)
|
| 126 |
+
return dataset
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
def main() -> None:
|
| 130 |
+
download_if_needed(XML_URL, CACHE_FILE)
|
| 131 |
+
dataset = build_dataset(CACHE_FILE)
|
| 132 |
+
output_path = Path(__file__).parent / f"{SOURCE}.parquet"
|
| 133 |
+
logger.info("Writing %s rows to %s", len(dataset), output_path)
|
| 134 |
+
dataset.to_parquet(output_path)
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
if __name__ == "__main__":
|
| 138 |
+
log_path = Path(__file__).parent / f"{SOURCE}.log"
|
| 139 |
+
logging.basicConfig(
|
| 140 |
+
level=logging.INFO,
|
| 141 |
+
format="%(asctime)s - %(levelname)s - %(message)s",
|
| 142 |
+
handlers=[logging.StreamHandler(), logging.FileHandler(log_path)],
|
| 143 |
+
)
|
| 144 |
+
main()
|
data/flashback-dator/descriptive_stats.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"number_of_samples": 18929823,
|
| 3 |
+
"number_of_tokens": 512795188,
|
| 4 |
+
"min_length_tokens": 2,
|
| 5 |
+
"max_length_tokens": 65536,
|
| 6 |
+
"number_of_characters": 1527673015,
|
| 7 |
+
"min_length_characters": 1,
|
| 8 |
+
"max_length_characters": 131069
|
| 9 |
+
}
|
data/flashback-dator/flashback-dator.log
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/flashback-dator/flashback-dator.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: 'Flashback: Computers & IT'
|
| 3 |
+
language:
|
| 4 |
+
- sv
|
| 5 |
+
license: cc-by-4.0
|
| 6 |
+
license_name: CC-BY 4.0
|
| 7 |
+
size_categories:
|
| 8 |
+
- 10M<n<100M
|
| 9 |
+
task_categories:
|
| 10 |
+
- text-generation
|
| 11 |
+
- fill-mask
|
| 12 |
+
task_ids:
|
| 13 |
+
- language-modeling
|
| 14 |
+
source_datasets:
|
| 15 |
+
- original
|
| 16 |
+
domains:
|
| 17 |
+
- Social Media
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# Dataset Card for Flashback: Computers & IT
|
| 21 |
+
|
| 22 |
+
<!-- START-SHORT DESCRIPTION -->
|
| 23 |
+
Sentences from the Computers & IT subforum of [Flashback](https://www.flashback.org), a large Swedish internet forum.
|
| 24 |
+
<!-- END-SHORT DESCRIPTION -->
|
| 25 |
+
|
| 26 |
+
This subset contains sentences from the Computers & IT subforum of Flashback, one of Sweden's largest internet forums. Each sample corresponds to a single sentence — the source corpus supplies sentences in scrambled order for copyright and privacy reasons, so the original post context is not recoverable.
|
| 27 |
+
|
| 28 |
+
## Dataset Description
|
| 29 |
+
|
| 30 |
+
<!-- START-DESC-STATS -->
|
| 31 |
+
- **Number of samples**: 18.93M
|
| 32 |
+
- **Number of tokens (Llama 3)**: 512.80M
|
| 33 |
+
- **Average document length in tokens (min, max)**: 27.09 (2, 65.54K)
|
| 34 |
+
<!-- END-DESC-STATS -->
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
## Dataset Structure
|
| 38 |
+
An example from the dataset looks as follows.
|
| 39 |
+
|
| 40 |
+
<!-- START-SAMPLE -->
|
| 41 |
+
```py
|
| 42 |
+
{
|
| 43 |
+
"id": "flashback-dator_00000001",
|
| 44 |
+
"text": "Äh, överspännings skydd är onödigt, bytt hela datorn utan.",
|
| 45 |
+
"source": "flashback-dator",
|
| 46 |
+
"added": "2026-07-19",
|
| 47 |
+
"created": "2007-07-13, 2007-07-13",
|
| 48 |
+
"token_count": 26
|
| 49 |
+
}
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
### Data Fields
|
| 53 |
+
|
| 54 |
+
An entry in the dataset consists of the following fields:
|
| 55 |
+
|
| 56 |
+
- `id` (`str`): A unique identifier for each document.
|
| 57 |
+
- `text` (`str`): The content of the document.
|
| 58 |
+
- `source` (`str`): The source of the document (see [Source Data](#source-data)).
|
| 59 |
+
- `added` (`str`): The date when the document was added to this collection.
|
| 60 |
+
- `created` (`str`): The date range when the document was originally created.
|
| 61 |
+
- `token_count` (`int`): The number of tokens in the sample computed using the Llama 3 tokenizer.
|
| 62 |
+
<!-- END-SAMPLE -->
|
| 63 |
+
|
| 64 |
+
### Dataset Statistics
|
| 65 |
+
|
| 66 |
+
<!-- START-DATASET PLOTS -->
|
| 67 |
+
<p align="center">
|
| 68 |
+
<img src="./images/dist_document_length.png" width="600" style="margin-right: 10px;" />
|
| 69 |
+
</p>
|
| 70 |
+
<!-- END-DATASET PLOTS -->
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
## Additional Information
|
| 74 |
+
|
| 75 |
+
### Limitations
|
| 76 |
+
|
| 77 |
+
Each sample is a single sentence. The source corpus deliberately scrambles sentence order for copyright and privacy protection, so the original post context is not recoverable.
|
| 78 |
+
|
| 79 |
+
The source material is tokenized and does not preserve the original spacing between tokens. We approximate readable spacing when reconstructing plain text.
|
| 80 |
+
|
| 81 |
+
As a forum corpus, this material contains informal, colloquial, and potentially offensive language.
|
| 82 |
+
|
| 83 |
+
### Source
|
| 84 |
+
|
| 85 |
+
We download the corpus from Språkbanken Text's official source file. Språkbanken Text distributes the corpus with DOI `10.23695/0j57-m676`.
|
| 86 |
+
|
| 87 |
+
### Citation Information
|
| 88 |
+
|
| 89 |
+
If you use this subset, cite the original source release:
|
| 90 |
+
|
| 91 |
+
> Språkbanken Text (2025). Flashback: Computers & IT (updated: 2025-04-01). [Data set]. Språkbanken Text. https://doi.org/10.23695/0j57-m676
|
| 92 |
+
|
| 93 |
+
```bibtex
|
| 94 |
+
@misc{flashback_dator,
|
| 95 |
+
doi = {10.23695/0j57-m676},
|
| 96 |
+
url = {https://spraakbanken.gu.se/en/resources/flashback-dator},
|
| 97 |
+
author = {Språkbanken Text},
|
| 98 |
+
language = {swe},
|
| 99 |
+
title = {Flashback: Computers & IT},
|
| 100 |
+
publisher = {Språkbanken Text},
|
| 101 |
+
year = {2025}
|
| 102 |
+
}
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
## License Information
|
| 106 |
+
|
| 107 |
+
The source corpus is distributed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
data/flashback-dator/flashback-dator.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b31612ab7d83f6ef1b9aa286ad80444f8119dc4db4c6dbce8c0444182783f036
|
| 3 |
+
size 1230583927
|
data/flashback-dator/images/dist_document_length.png
ADDED
|
Git LFS Details
|
data/flashback-droger/create.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /// script
|
| 2 |
+
# requires-python = ">=3.12"
|
| 3 |
+
# dependencies = [
|
| 4 |
+
# "datasets>=3.0.0",
|
| 5 |
+
# "dynaword",
|
| 6 |
+
# "pydantic>=2.10.4",
|
| 7 |
+
# "transformers>=4.47.1",
|
| 8 |
+
# ]
|
| 9 |
+
#
|
| 10 |
+
# [tool.uv.sources]
|
| 11 |
+
# dynaword = { path = "../.." }
|
| 12 |
+
# ///
|
| 13 |
+
|
| 14 |
+
"""Download and process Språkbanken Text's `flashback-droger` corpus."""
|
| 15 |
+
|
| 16 |
+
import bz2
|
| 17 |
+
import logging
|
| 18 |
+
import urllib.request
|
| 19 |
+
import xml.etree.ElementTree as ET
|
| 20 |
+
from datetime import date
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
|
| 23 |
+
import datasets
|
| 24 |
+
from datasets import Dataset
|
| 25 |
+
from dynaword.process_dataset import (
|
| 26 |
+
add_token_count,
|
| 27 |
+
ensure_column_order,
|
| 28 |
+
remove_duplicate_text,
|
| 29 |
+
remove_empty_texts,
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
logger = logging.getLogger(__name__)
|
| 33 |
+
|
| 34 |
+
SOURCE = "flashback-droger"
|
| 35 |
+
XML_URL = "https://spraakbanken.gu.se/resurser/meningsmangder/flashback-droger.xml.bz2"
|
| 36 |
+
CACHE_FILE = Path(__file__).parent / "cache" / "flashback-droger.xml.bz2"
|
| 37 |
+
|
| 38 |
+
NO_SPACE_BEFORE = (".", ",", ";", ":", "!", "?", ")", "]", "}", "»")
|
| 39 |
+
NO_SPACE_AFTER = ("(", "[", "{", "«")
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def download_if_needed(url: str, path: Path) -> None:
|
| 43 |
+
if path.exists():
|
| 44 |
+
logger.info("Using cached %s", path)
|
| 45 |
+
return
|
| 46 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 47 |
+
logger.info("Downloading %s to %s", url, path)
|
| 48 |
+
urllib.request.urlretrieve(url, path)
|
| 49 |
+
logger.info("Download complete")
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def format_date(value: str) -> str:
|
| 53 |
+
return f"{value[:4]}-{value[4:6]}-{value[6:8]}"
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def detokenize(tokens: list[str]) -> str:
|
| 57 |
+
text = " ".join(t.strip() for t in tokens if t and t.strip())
|
| 58 |
+
for token in NO_SPACE_BEFORE:
|
| 59 |
+
text = text.replace(f" {token}", token)
|
| 60 |
+
for token in NO_SPACE_AFTER:
|
| 61 |
+
text = text.replace(f"{token} ", token)
|
| 62 |
+
return " ".join(text.split()).strip()
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def sentence_text(sentence: ET.Element) -> str:
|
| 66 |
+
tokens = [(t.text or "") for t in sentence.iter("token")]
|
| 67 |
+
return detokenize(tokens)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def iter_sentences(bz2_path: Path):
|
| 71 |
+
current_created = ""
|
| 72 |
+
index = 0
|
| 73 |
+
today = date.today().strftime("%Y-%m-%d")
|
| 74 |
+
with bz2.open(bz2_path, "rb") as f:
|
| 75 |
+
parent_stack: list[ET.Element] = []
|
| 76 |
+
for event, elem in ET.iterparse(f, events=("start", "end")):
|
| 77 |
+
if event == "start":
|
| 78 |
+
parent_stack.append(elem)
|
| 79 |
+
if elem.tag == "text":
|
| 80 |
+
datefrom = elem.attrib.get("datefrom", "")
|
| 81 |
+
dateto = elem.attrib.get("dateto", "")
|
| 82 |
+
current_created = (
|
| 83 |
+
f"{format_date(datefrom)}, {format_date(dateto)}"
|
| 84 |
+
if datefrom and dateto
|
| 85 |
+
else ""
|
| 86 |
+
)
|
| 87 |
+
else:
|
| 88 |
+
if elem.tag == "sentence":
|
| 89 |
+
text = sentence_text(elem)
|
| 90 |
+
if text:
|
| 91 |
+
index += 1
|
| 92 |
+
yield {
|
| 93 |
+
"id": f"{SOURCE}_{index:08d}",
|
| 94 |
+
"text": text,
|
| 95 |
+
"source": SOURCE,
|
| 96 |
+
"added": today,
|
| 97 |
+
"created": current_created,
|
| 98 |
+
}
|
| 99 |
+
if len(parent_stack) >= 2:
|
| 100 |
+
parent_stack[-2].remove(elem)
|
| 101 |
+
elem.clear()
|
| 102 |
+
elif elem.tag in ("text", "paragraph"):
|
| 103 |
+
if len(parent_stack) >= 2:
|
| 104 |
+
parent_stack[-2].remove(elem)
|
| 105 |
+
elem.clear()
|
| 106 |
+
parent_stack.pop()
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def build_dataset(bz2_path: Path) -> Dataset:
|
| 110 |
+
datasets.disable_caching()
|
| 111 |
+
dataset = Dataset.from_generator(lambda: iter_sentences(bz2_path))
|
| 112 |
+
dataset = remove_empty_texts(dataset)
|
| 113 |
+
dataset = remove_duplicate_text(dataset)
|
| 114 |
+
dataset = add_token_count(dataset)
|
| 115 |
+
dataset = ensure_column_order(dataset)
|
| 116 |
+
return dataset
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def main() -> None:
|
| 120 |
+
download_if_needed(XML_URL, CACHE_FILE)
|
| 121 |
+
dataset = build_dataset(CACHE_FILE)
|
| 122 |
+
output_path = Path(__file__).parent / f"{SOURCE}.parquet"
|
| 123 |
+
logger.info("Writing %s rows to %s", len(dataset), output_path)
|
| 124 |
+
dataset.to_parquet(output_path)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
log_path = Path(__file__).parent / f"{SOURCE}.log"
|
| 129 |
+
logging.basicConfig(
|
| 130 |
+
level=logging.INFO,
|
| 131 |
+
format="%(asctime)s - %(levelname)s - %(message)s",
|
| 132 |
+
handlers=[logging.StreamHandler(), logging.FileHandler(log_path)],
|
| 133 |
+
)
|
| 134 |
+
main()
|
data/flashback-droger/descriptive_stats.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"number_of_samples": 14515372,
|
| 3 |
+
"number_of_tokens": 403090735,
|
| 4 |
+
"min_length_tokens": 2,
|
| 5 |
+
"max_length_tokens": 10549,
|
| 6 |
+
"number_of_characters": 1171098003,
|
| 7 |
+
"min_length_characters": 1,
|
| 8 |
+
"max_length_characters": 22423
|
| 9 |
+
}
|
data/flashback-droger/flashback-droger.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: 'Flashback: Drugs'
|
| 3 |
+
language:
|
| 4 |
+
- sv
|
| 5 |
+
license: cc-by-4.0
|
| 6 |
+
license_name: CC-BY 4.0
|
| 7 |
+
size_categories:
|
| 8 |
+
- 10M<n<100M
|
| 9 |
+
task_categories:
|
| 10 |
+
- text-generation
|
| 11 |
+
- fill-mask
|
| 12 |
+
task_ids:
|
| 13 |
+
- language-modeling
|
| 14 |
+
source_datasets:
|
| 15 |
+
- original
|
| 16 |
+
domains:
|
| 17 |
+
- Social Media
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# Dataset Card for Flashback: Drugs
|
| 21 |
+
|
| 22 |
+
<!-- START-SHORT DESCRIPTION -->
|
| 23 |
+
Sentences from the Drugs subforum of [Flashback](https://www.flashback.org), a large Swedish internet forum.
|
| 24 |
+
<!-- END-SHORT DESCRIPTION -->
|
| 25 |
+
|
| 26 |
+
This subset contains sentences from the Drugs subforum of Flashback, one of Sweden's largest internet forums. Each sample corresponds to a single sentence — the source corpus supplies sentences in scrambled order for copyright and privacy reasons, so the original post context is not recoverable.
|
| 27 |
+
|
| 28 |
+
## Dataset Description
|
| 29 |
+
|
| 30 |
+
<!-- START-DESC-STATS -->
|
| 31 |
+
- **Number of samples**: 14.52M
|
| 32 |
+
- **Number of tokens (Llama 3)**: 403.09M
|
| 33 |
+
- **Average document length in tokens (min, max)**: 27.77 (2, 10.55K)
|
| 34 |
+
<!-- END-DESC-STATS -->
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
## Dataset Structure
|
| 38 |
+
An example from the dataset looks as follows.
|
| 39 |
+
|
| 40 |
+
<!-- START-SAMPLE -->
|
| 41 |
+
```py
|
| 42 |
+
{
|
| 43 |
+
"id": "flashback-droger_00000001",
|
| 44 |
+
"text": "Han gör vad som helst för wievs på sin kanal.",
|
| 45 |
+
"source": "flashback-droger",
|
| 46 |
+
"added": "2026-07-19",
|
| 47 |
+
"created": "2022-11-12, 2022-11-12",
|
| 48 |
+
"token_count": 14
|
| 49 |
+
}
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
### Data Fields
|
| 53 |
+
|
| 54 |
+
An entry in the dataset consists of the following fields:
|
| 55 |
+
|
| 56 |
+
- `id` (`str`): A unique identifier for each document.
|
| 57 |
+
- `text` (`str`): The content of the document.
|
| 58 |
+
- `source` (`str`): The source of the document (see [Source Data](#source-data)).
|
| 59 |
+
- `added` (`str`): The date when the document was added to this collection.
|
| 60 |
+
- `created` (`str`): The date range when the document was originally created.
|
| 61 |
+
- `token_count` (`int`): The number of tokens in the sample computed using the Llama 3 tokenizer.
|
| 62 |
+
<!-- END-SAMPLE -->
|
| 63 |
+
|
| 64 |
+
### Dataset Statistics
|
| 65 |
+
|
| 66 |
+
<!-- START-DATASET PLOTS -->
|
| 67 |
+
<p align="center">
|
| 68 |
+
<img src="./images/dist_document_length.png" width="600" style="margin-right: 10px;" />
|
| 69 |
+
</p>
|
| 70 |
+
<!-- END-DATASET PLOTS -->
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
## Additional Information
|
| 74 |
+
|
| 75 |
+
### Limitations
|
| 76 |
+
|
| 77 |
+
Each sample is a single sentence. The source corpus deliberately scrambles sentence order for copyright and privacy protection, so the original post context is not recoverable.
|
| 78 |
+
|
| 79 |
+
The source material is tokenized and does not preserve the original spacing between tokens. We approximate readable spacing when reconstructing plain text.
|
| 80 |
+
|
| 81 |
+
As a forum corpus, this material contains informal, colloquial, and potentially offensive language.
|
| 82 |
+
|
| 83 |
+
### Source
|
| 84 |
+
|
| 85 |
+
We download the corpus from Språkbanken Text's official source file for *Flashback: Drugs*.
|
| 86 |
+
|
| 87 |
+
### Citation Information
|
| 88 |
+
|
| 89 |
+
If you use this subset, cite the original source release:
|
| 90 |
+
|
| 91 |
+
> Språkbanken Text (2025). Flashback: Drugs (updated: 2025-04-01). [Data set]. Språkbanken Text.
|
| 92 |
+
|
| 93 |
+
## License Information
|
| 94 |
+
|
| 95 |
+
The source corpus is distributed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
data/flashback-droger/flashback-droger.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:10591c5bf79c823909a20b4c8d3da96c2640c243f388d1f5b6686ad84aebe1f7
|
| 3 |
+
size 956004586
|
data/flashback-droger/images/dist_document_length.png
ADDED
|
Git LFS Details
|
data/flashback-ekonomi/create.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /// script
|
| 2 |
+
# requires-python = ">=3.12"
|
| 3 |
+
# dependencies = [
|
| 4 |
+
# "datasets>=3.0.0",
|
| 5 |
+
# "dynaword",
|
| 6 |
+
# "pydantic>=2.10.4",
|
| 7 |
+
# "transformers>=4.47.1",
|
| 8 |
+
# ]
|
| 9 |
+
#
|
| 10 |
+
# [tool.uv.sources]
|
| 11 |
+
# dynaword = { path = "../.." }
|
| 12 |
+
# ///
|
| 13 |
+
|
| 14 |
+
"""Download and process Språkbanken Text's `flashback-ekonomi` corpus."""
|
| 15 |
+
|
| 16 |
+
import bz2
|
| 17 |
+
import logging
|
| 18 |
+
import urllib.request
|
| 19 |
+
import xml.etree.ElementTree as ET
|
| 20 |
+
from datetime import date
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
|
| 23 |
+
import datasets
|
| 24 |
+
from datasets import Dataset
|
| 25 |
+
from dynaword.process_dataset import (
|
| 26 |
+
add_token_count,
|
| 27 |
+
ensure_column_order,
|
| 28 |
+
remove_duplicate_text,
|
| 29 |
+
remove_empty_texts,
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
logger = logging.getLogger(__name__)
|
| 33 |
+
|
| 34 |
+
SOURCE = "flashback-ekonomi"
|
| 35 |
+
XML_URL = "https://spraakbanken.gu.se/resurser/meningsmangder/flashback-ekonomi.xml.bz2"
|
| 36 |
+
CACHE_FILE = Path(__file__).parent / "cache" / "flashback-ekonomi.xml.bz2"
|
| 37 |
+
|
| 38 |
+
NO_SPACE_BEFORE = (".", ",", ";", ":", "!", "?", ")", "]", "}", "»")
|
| 39 |
+
NO_SPACE_AFTER = ("(", "[", "{", "«")
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def download_if_needed(url: str, path: Path) -> None:
|
| 43 |
+
if path.exists():
|
| 44 |
+
logger.info("Using cached %s", path)
|
| 45 |
+
return
|
| 46 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 47 |
+
logger.info("Downloading %s to %s", url, path)
|
| 48 |
+
urllib.request.urlretrieve(url, path)
|
| 49 |
+
logger.info("Download complete")
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def format_date(value: str) -> str:
|
| 53 |
+
return f"{value[:4]}-{value[4:6]}-{value[6:8]}"
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def detokenize(tokens: list[str]) -> str:
|
| 57 |
+
text = " ".join(t.strip() for t in tokens if t and t.strip())
|
| 58 |
+
for token in NO_SPACE_BEFORE:
|
| 59 |
+
text = text.replace(f" {token}", token)
|
| 60 |
+
for token in NO_SPACE_AFTER:
|
| 61 |
+
text = text.replace(f"{token} ", token)
|
| 62 |
+
return " ".join(text.split()).strip()
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def sentence_text(sentence: ET.Element) -> str:
|
| 66 |
+
tokens = [(t.text or "") for t in sentence.iter("token")]
|
| 67 |
+
return detokenize(tokens)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def iter_sentences(bz2_path: Path):
|
| 71 |
+
current_created = ""
|
| 72 |
+
index = 0
|
| 73 |
+
today = date.today().strftime("%Y-%m-%d")
|
| 74 |
+
with bz2.open(bz2_path, "rb") as f:
|
| 75 |
+
parent_stack: list[ET.Element] = []
|
| 76 |
+
for event, elem in ET.iterparse(f, events=("start", "end")):
|
| 77 |
+
if event == "start":
|
| 78 |
+
parent_stack.append(elem)
|
| 79 |
+
if elem.tag == "text":
|
| 80 |
+
datefrom = elem.attrib.get("datefrom", "")
|
| 81 |
+
dateto = elem.attrib.get("dateto", "")
|
| 82 |
+
current_created = (
|
| 83 |
+
f"{format_date(datefrom)}, {format_date(dateto)}"
|
| 84 |
+
if datefrom and dateto
|
| 85 |
+
else ""
|
| 86 |
+
)
|
| 87 |
+
else:
|
| 88 |
+
if elem.tag == "sentence":
|
| 89 |
+
text = sentence_text(elem)
|
| 90 |
+
if text:
|
| 91 |
+
index += 1
|
| 92 |
+
yield {
|
| 93 |
+
"id": f"{SOURCE}_{index:08d}",
|
| 94 |
+
"text": text,
|
| 95 |
+
"source": SOURCE,
|
| 96 |
+
"added": today,
|
| 97 |
+
"created": current_created,
|
| 98 |
+
}
|
| 99 |
+
if len(parent_stack) >= 2:
|
| 100 |
+
parent_stack[-2].remove(elem)
|
| 101 |
+
elem.clear()
|
| 102 |
+
elif elem.tag in ("text", "paragraph"):
|
| 103 |
+
if len(parent_stack) >= 2:
|
| 104 |
+
parent_stack[-2].remove(elem)
|
| 105 |
+
elem.clear()
|
| 106 |
+
parent_stack.pop()
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def build_dataset(bz2_path: Path) -> Dataset:
|
| 110 |
+
datasets.disable_caching()
|
| 111 |
+
dataset = Dataset.from_generator(lambda: iter_sentences(bz2_path))
|
| 112 |
+
dataset = remove_empty_texts(dataset)
|
| 113 |
+
dataset = remove_duplicate_text(dataset)
|
| 114 |
+
dataset = add_token_count(dataset)
|
| 115 |
+
dataset = ensure_column_order(dataset)
|
| 116 |
+
return dataset
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def main() -> None:
|
| 120 |
+
download_if_needed(XML_URL, CACHE_FILE)
|
| 121 |
+
dataset = build_dataset(CACHE_FILE)
|
| 122 |
+
output_path = Path(__file__).parent / f"{SOURCE}.parquet"
|
| 123 |
+
logger.info("Writing %s rows to %s", len(dataset), output_path)
|
| 124 |
+
dataset.to_parquet(output_path)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
log_path = Path(__file__).parent / f"{SOURCE}.log"
|
| 129 |
+
logging.basicConfig(
|
| 130 |
+
level=logging.INFO,
|
| 131 |
+
format="%(asctime)s - %(levelname)s - %(message)s",
|
| 132 |
+
handlers=[logging.StreamHandler(), logging.FileHandler(log_path)],
|
| 133 |
+
)
|
| 134 |
+
main()
|
data/flashback-ekonomi/descriptive_stats.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"number_of_samples": 8795695,
|
| 3 |
+
"number_of_tokens": 248006936,
|
| 4 |
+
"min_length_tokens": 2,
|
| 5 |
+
"max_length_tokens": 4641,
|
| 6 |
+
"number_of_characters": 723117973,
|
| 7 |
+
"min_length_characters": 1,
|
| 8 |
+
"max_length_characters": 8070
|
| 9 |
+
}
|
data/flashback-ekonomi/flashback-ekonomi.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: 'Flashback: Economy'
|
| 3 |
+
language:
|
| 4 |
+
- sv
|
| 5 |
+
license: cc-by-4.0
|
| 6 |
+
license_name: CC-BY 4.0
|
| 7 |
+
size_categories:
|
| 8 |
+
- 1M<n<10M
|
| 9 |
+
task_categories:
|
| 10 |
+
- text-generation
|
| 11 |
+
- fill-mask
|
| 12 |
+
task_ids:
|
| 13 |
+
- language-modeling
|
| 14 |
+
source_datasets:
|
| 15 |
+
- original
|
| 16 |
+
domains:
|
| 17 |
+
- Social Media
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# Dataset Card for Flashback: Economy
|
| 21 |
+
|
| 22 |
+
<!-- START-SHORT DESCRIPTION -->
|
| 23 |
+
Sentences from the Economy subforum of [Flashback](https://www.flashback.org), a large Swedish internet forum.
|
| 24 |
+
<!-- END-SHORT DESCRIPTION -->
|
| 25 |
+
|
| 26 |
+
This subset contains sentences from the Economy subforum of Flashback, one of Sweden's largest internet forums. Each sample corresponds to a single sentence — the source corpus supplies sentences in scrambled order for copyright and privacy reasons, so the original post context is not recoverable.
|
| 27 |
+
|
| 28 |
+
## Dataset Description
|
| 29 |
+
|
| 30 |
+
<!-- START-DESC-STATS -->
|
| 31 |
+
- **Number of samples**: 8.80M
|
| 32 |
+
- **Number of tokens (Llama 3)**: 248.01M
|
| 33 |
+
- **Average document length in tokens (min, max)**: 28.2 (2, 4.64K)
|
| 34 |
+
<!-- END-DESC-STATS -->
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
## Dataset Structure
|
| 38 |
+
An example from the dataset looks as follows.
|
| 39 |
+
|
| 40 |
+
<!-- START-SAMPLE -->
|
| 41 |
+
```py
|
| 42 |
+
{
|
| 43 |
+
"id": "flashback-ekonomi_00000001",
|
| 44 |
+
"text": "Skulle jag belåna min fastighet, skulle jag ta ett reallån och betala realränta på det.",
|
| 45 |
+
"source": "flashback-ekonomi",
|
| 46 |
+
"added": "2026-05-30",
|
| 47 |
+
"created": "2008-03-29, 2008-03-29",
|
| 48 |
+
"token_count": 29
|
| 49 |
+
}
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
### Data Fields
|
| 53 |
+
|
| 54 |
+
An entry in the dataset consists of the following fields:
|
| 55 |
+
|
| 56 |
+
- `id` (`str`): A unique identifier for each document.
|
| 57 |
+
- `text` (`str`): The content of the document.
|
| 58 |
+
- `source` (`str`): The source of the document (see [Source Data](#source-data)).
|
| 59 |
+
- `added` (`str`): The date when the document was added to this collection.
|
| 60 |
+
- `created` (`str`): The date range when the document was originally created.
|
| 61 |
+
- `token_count` (`int`): The number of tokens in the sample computed using the Llama 3 tokenizer.
|
| 62 |
+
<!-- END-SAMPLE -->
|
| 63 |
+
|
| 64 |
+
### Dataset Statistics
|
| 65 |
+
|
| 66 |
+
<!-- START-DATASET PLOTS -->
|
| 67 |
+
<p align="center">
|
| 68 |
+
<img src="./images/dist_document_length.png" width="600" style="margin-right: 10px;" />
|
| 69 |
+
</p>
|
| 70 |
+
<!-- END-DATASET PLOTS -->
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
## Additional Information
|
| 74 |
+
|
| 75 |
+
### Limitations
|
| 76 |
+
|
| 77 |
+
Each sample is a single sentence. The source corpus deliberately scrambles sentence order for copyright and privacy protection, so the original post context is not recoverable.
|
| 78 |
+
|
| 79 |
+
The source material is tokenized and does not preserve the original spacing between tokens. We approximate readable spacing when reconstructing plain text.
|
| 80 |
+
|
| 81 |
+
As a forum corpus, this material contains informal, colloquial, and potentially offensive language.
|
| 82 |
+
|
| 83 |
+
### Source
|
| 84 |
+
|
| 85 |
+
We download the corpus from Språkbanken Text's official source file for *Flashback: Economy*.
|
| 86 |
+
|
| 87 |
+
### Citation Information
|
| 88 |
+
|
| 89 |
+
If you use this subset, cite the original source release:
|
| 90 |
+
|
| 91 |
+
> Språkbanken Text (2025). Flashback: Economy (updated: 2025-04-01). [Data set]. Språkbanken Text.
|
| 92 |
+
|
| 93 |
+
## License Information
|
| 94 |
+
|
| 95 |
+
The source corpus is distributed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
data/flashback-ekonomi/flashback-ekonomi.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ec0f7e2e64bf88af9c1b7933bc40b6c853f459ba756d461153253a6f113fe543
|
| 3 |
+
size 584779090
|
data/flashback-ekonomi/images/dist_document_length.png
ADDED
|
Git LFS Details
|
data/flashback-hem/create.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /// script
|
| 2 |
+
# requires-python = ">=3.12"
|
| 3 |
+
# dependencies = [
|
| 4 |
+
# "datasets>=3.0.0",
|
| 5 |
+
# "dynaword",
|
| 6 |
+
# "pydantic>=2.10.4",
|
| 7 |
+
# "transformers>=4.47.1",
|
| 8 |
+
# ]
|
| 9 |
+
#
|
| 10 |
+
# [tool.uv.sources]
|
| 11 |
+
# dynaword = { path = "../.." }
|
| 12 |
+
# ///
|
| 13 |
+
|
| 14 |
+
"""Download and process Språkbanken Text's `flashback-hem` corpus."""
|
| 15 |
+
|
| 16 |
+
import bz2
|
| 17 |
+
import logging
|
| 18 |
+
import urllib.request
|
| 19 |
+
import xml.etree.ElementTree as ET
|
| 20 |
+
from datetime import date
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
|
| 23 |
+
import datasets
|
| 24 |
+
from datasets import Dataset
|
| 25 |
+
from dynaword.process_dataset import (
|
| 26 |
+
add_token_count,
|
| 27 |
+
ensure_column_order,
|
| 28 |
+
remove_duplicate_text,
|
| 29 |
+
remove_empty_texts,
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
logger = logging.getLogger(__name__)
|
| 33 |
+
|
| 34 |
+
SOURCE = "flashback-hem"
|
| 35 |
+
XML_URL = "https://spraakbanken.gu.se/resurser/meningsmangder/flashback-hem.xml.bz2"
|
| 36 |
+
CACHE_FILE = Path(__file__).parent / "cache" / "flashback-hem.xml.bz2"
|
| 37 |
+
|
| 38 |
+
NO_SPACE_BEFORE = (".", ",", ";", ":", "!", "?", ")", "]", "}", "»")
|
| 39 |
+
NO_SPACE_AFTER = ("(", "[", "{", "«")
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def download_if_needed(url: str, path: Path) -> None:
|
| 43 |
+
if path.exists():
|
| 44 |
+
logger.info("Using cached %s", path)
|
| 45 |
+
return
|
| 46 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 47 |
+
logger.info("Downloading %s to %s", url, path)
|
| 48 |
+
urllib.request.urlretrieve(url, path)
|
| 49 |
+
logger.info("Download complete")
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def format_date(value: str) -> str:
|
| 53 |
+
return f"{value[:4]}-{value[4:6]}-{value[6:8]}"
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def detokenize(tokens: list[str]) -> str:
|
| 57 |
+
text = " ".join(t.strip() for t in tokens if t and t.strip())
|
| 58 |
+
for token in NO_SPACE_BEFORE:
|
| 59 |
+
text = text.replace(f" {token}", token)
|
| 60 |
+
for token in NO_SPACE_AFTER:
|
| 61 |
+
text = text.replace(f"{token} ", token)
|
| 62 |
+
return " ".join(text.split()).strip()
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def sentence_text(sentence: ET.Element) -> str:
|
| 66 |
+
tokens = [(t.text or "") for t in sentence.iter("token")]
|
| 67 |
+
return detokenize(tokens)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def iter_sentences(bz2_path: Path):
|
| 71 |
+
current_created = ""
|
| 72 |
+
index = 0
|
| 73 |
+
today = date.today().strftime("%Y-%m-%d")
|
| 74 |
+
with bz2.open(bz2_path, "rb") as f:
|
| 75 |
+
parent_stack: list[ET.Element] = []
|
| 76 |
+
for event, elem in ET.iterparse(f, events=("start", "end")):
|
| 77 |
+
if event == "start":
|
| 78 |
+
parent_stack.append(elem)
|
| 79 |
+
if elem.tag == "text":
|
| 80 |
+
datefrom = elem.attrib.get("datefrom", "")
|
| 81 |
+
dateto = elem.attrib.get("dateto", "")
|
| 82 |
+
current_created = (
|
| 83 |
+
f"{format_date(datefrom)}, {format_date(dateto)}"
|
| 84 |
+
if datefrom and dateto
|
| 85 |
+
else ""
|
| 86 |
+
)
|
| 87 |
+
else:
|
| 88 |
+
if elem.tag == "sentence":
|
| 89 |
+
text = sentence_text(elem)
|
| 90 |
+
if text:
|
| 91 |
+
index += 1
|
| 92 |
+
yield {
|
| 93 |
+
"id": f"{SOURCE}_{index:08d}",
|
| 94 |
+
"text": text,
|
| 95 |
+
"source": SOURCE,
|
| 96 |
+
"added": today,
|
| 97 |
+
"created": current_created,
|
| 98 |
+
}
|
| 99 |
+
if len(parent_stack) >= 2:
|
| 100 |
+
parent_stack[-2].remove(elem)
|
| 101 |
+
elem.clear()
|
| 102 |
+
elif elem.tag in ("text", "paragraph"):
|
| 103 |
+
if len(parent_stack) >= 2:
|
| 104 |
+
parent_stack[-2].remove(elem)
|
| 105 |
+
elem.clear()
|
| 106 |
+
parent_stack.pop()
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def build_dataset(bz2_path: Path) -> Dataset:
|
| 110 |
+
datasets.disable_caching()
|
| 111 |
+
dataset = Dataset.from_generator(lambda: iter_sentences(bz2_path))
|
| 112 |
+
dataset = remove_empty_texts(dataset)
|
| 113 |
+
dataset = remove_duplicate_text(dataset)
|
| 114 |
+
dataset = add_token_count(dataset)
|
| 115 |
+
dataset = ensure_column_order(dataset)
|
| 116 |
+
return dataset
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def main() -> None:
|
| 120 |
+
download_if_needed(XML_URL, CACHE_FILE)
|
| 121 |
+
dataset = build_dataset(CACHE_FILE)
|
| 122 |
+
output_path = Path(__file__).parent / f"{SOURCE}.parquet"
|
| 123 |
+
logger.info("Writing %s rows to %s", len(dataset), output_path)
|
| 124 |
+
dataset.to_parquet(output_path)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
log_path = Path(__file__).parent / f"{SOURCE}.log"
|
| 129 |
+
logging.basicConfig(
|
| 130 |
+
level=logging.INFO,
|
| 131 |
+
format="%(asctime)s - %(levelname)s - %(message)s",
|
| 132 |
+
handlers=[logging.StreamHandler(), logging.FileHandler(log_path)],
|
| 133 |
+
)
|
| 134 |
+
main()
|
data/flashback-hem/descriptive_stats.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"number_of_samples": 21921903,
|
| 3 |
+
"number_of_tokens": 617343364,
|
| 4 |
+
"min_length_tokens": 2,
|
| 5 |
+
"max_length_tokens": 6850,
|
| 6 |
+
"number_of_characters": 1822902453,
|
| 7 |
+
"min_length_characters": 1,
|
| 8 |
+
"max_length_characters": 9923
|
| 9 |
+
}
|
data/flashback-hem/flashback-hem.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: 'Flashback: Home & Garden'
|
| 3 |
+
language:
|
| 4 |
+
- sv
|
| 5 |
+
license: cc-by-4.0
|
| 6 |
+
license_name: CC-BY 4.0
|
| 7 |
+
size_categories:
|
| 8 |
+
- 10M<n<100M
|
| 9 |
+
task_categories:
|
| 10 |
+
- text-generation
|
| 11 |
+
- fill-mask
|
| 12 |
+
task_ids:
|
| 13 |
+
- language-modeling
|
| 14 |
+
source_datasets:
|
| 15 |
+
- original
|
| 16 |
+
domains:
|
| 17 |
+
- Social Media
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# Dataset Card for Flashback: Home & Garden
|
| 21 |
+
|
| 22 |
+
<!-- START-SHORT DESCRIPTION -->
|
| 23 |
+
Sentences from the Home & Garden subforum of [Flashback](https://www.flashback.org), a large Swedish internet forum.
|
| 24 |
+
<!-- END-SHORT DESCRIPTION -->
|
| 25 |
+
|
| 26 |
+
This subset contains sentences from the Home & Garden subforum of Flashback, one of Sweden's largest internet forums. Each sample corresponds to a single sentence — the source corpus supplies sentences in scrambled order for copyright and privacy reasons, so the original post context is not recoverable.
|
| 27 |
+
|
| 28 |
+
## Dataset Description
|
| 29 |
+
|
| 30 |
+
<!-- START-DESC-STATS -->
|
| 31 |
+
- **Number of samples**: 21.92M
|
| 32 |
+
- **Number of tokens (Llama 3)**: 617.34M
|
| 33 |
+
- **Average document length in tokens (min, max)**: 28.16 (2, 6.85K)
|
| 34 |
+
<!-- END-DESC-STATS -->
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
## Dataset Structure
|
| 38 |
+
An example from the dataset looks as follows.
|
| 39 |
+
|
| 40 |
+
<!-- START-SAMPLE -->
|
| 41 |
+
```py
|
| 42 |
+
{
|
| 43 |
+
"id": "flashback-hem_00000001",
|
| 44 |
+
"text": "Politikerna får ta och släppa på \" orörda \" fasader samt tillåta modernare tystare anläggningar än d[...]",
|
| 45 |
+
"source": "flashback-hem",
|
| 46 |
+
"added": "2026-07-19",
|
| 47 |
+
"created": "2018-07-26, 2018-07-26",
|
| 48 |
+
"token_count": 43
|
| 49 |
+
}
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
### Data Fields
|
| 53 |
+
|
| 54 |
+
An entry in the dataset consists of the following fields:
|
| 55 |
+
|
| 56 |
+
- `id` (`str`): A unique identifier for each document.
|
| 57 |
+
- `text` (`str`): The content of the document.
|
| 58 |
+
- `source` (`str`): The source of the document (see [Source Data](#source-data)).
|
| 59 |
+
- `added` (`str`): The date when the document was added to this collection.
|
| 60 |
+
- `created` (`str`): The date range when the document was originally created.
|
| 61 |
+
- `token_count` (`int`): The number of tokens in the sample computed using the Llama 3 tokenizer.
|
| 62 |
+
<!-- END-SAMPLE -->
|
| 63 |
+
|
| 64 |
+
### Dataset Statistics
|
| 65 |
+
|
| 66 |
+
<!-- START-DATASET PLOTS -->
|
| 67 |
+
<p align="center">
|
| 68 |
+
<img src="./images/dist_document_length.png" width="600" style="margin-right: 10px;" />
|
| 69 |
+
</p>
|
| 70 |
+
<!-- END-DATASET PLOTS -->
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
## Additional Information
|
| 74 |
+
|
| 75 |
+
### Limitations
|
| 76 |
+
|
| 77 |
+
Each sample is a single sentence. The source corpus deliberately scrambles sentence order for copyright and privacy protection, so the original post context is not recoverable.
|
| 78 |
+
|
| 79 |
+
The source material is tokenized and does not preserve the original spacing between tokens. We approximate readable spacing when reconstructing plain text.
|
| 80 |
+
|
| 81 |
+
As a forum corpus, this material contains informal, colloquial, and potentially offensive language.
|
| 82 |
+
|
| 83 |
+
### Source
|
| 84 |
+
|
| 85 |
+
We download the corpus from Språkbanken Text's official source file for *Flashback: Home & Garden*.
|
| 86 |
+
|
| 87 |
+
### Citation Information
|
| 88 |
+
|
| 89 |
+
If you use this subset, cite the original source release:
|
| 90 |
+
|
| 91 |
+
> Språkbanken Text (2025). Flashback: Home & Garden (updated: 2025-04-01). [Data set]. Språkbanken Text.
|
| 92 |
+
|
| 93 |
+
## License Information
|
| 94 |
+
|
| 95 |
+
The source corpus is distributed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
data/flashback-hem/flashback-hem.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:878574cfc5377d51cc44729afb8b9d7102a304656e60bcff392bd44df5f7a348
|
| 3 |
+
size 1451912226
|
data/flashback-hem/images/dist_document_length.png
ADDED
|
Git LFS Details
|
data/flashback-kultur/create.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /// script
|
| 2 |
+
# requires-python = ">=3.12"
|
| 3 |
+
# dependencies = [
|
| 4 |
+
# "datasets>=3.0.0",
|
| 5 |
+
# "dynaword",
|
| 6 |
+
# "pydantic>=2.10.4",
|
| 7 |
+
# "transformers>=4.47.1",
|
| 8 |
+
# ]
|
| 9 |
+
#
|
| 10 |
+
# [tool.uv.sources]
|
| 11 |
+
# dynaword = { path = "../.." }
|
| 12 |
+
# ///
|
| 13 |
+
|
| 14 |
+
"""Download and process Språkbanken Text's `flashback-kultur` corpus."""
|
| 15 |
+
|
| 16 |
+
import bz2
|
| 17 |
+
import logging
|
| 18 |
+
import urllib.request
|
| 19 |
+
import xml.etree.ElementTree as ET
|
| 20 |
+
from datetime import date
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
|
| 23 |
+
import datasets
|
| 24 |
+
from datasets import Dataset
|
| 25 |
+
from dynaword.process_dataset import (
|
| 26 |
+
add_token_count,
|
| 27 |
+
ensure_column_order,
|
| 28 |
+
remove_duplicate_text,
|
| 29 |
+
remove_empty_texts,
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
logger = logging.getLogger(__name__)
|
| 33 |
+
|
| 34 |
+
SOURCE = "flashback-kultur"
|
| 35 |
+
XML_URL = "https://spraakbanken.gu.se/resurser/meningsmangder/flashback-kultur.xml.bz2"
|
| 36 |
+
CACHE_FILE = Path(__file__).parent / "cache" / "flashback-kultur.xml.bz2"
|
| 37 |
+
|
| 38 |
+
NO_SPACE_BEFORE = (".", ",", ";", ":", "!", "?", ")", "]", "}", "»")
|
| 39 |
+
NO_SPACE_AFTER = ("(", "[", "{", "«")
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def download_if_needed(url: str, path: Path) -> None:
|
| 43 |
+
if path.exists():
|
| 44 |
+
logger.info("Using cached %s", path)
|
| 45 |
+
return
|
| 46 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 47 |
+
logger.info("Downloading %s to %s", url, path)
|
| 48 |
+
urllib.request.urlretrieve(url, path)
|
| 49 |
+
logger.info("Download complete")
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def format_date(value: str) -> str:
|
| 53 |
+
return f"{value[:4]}-{value[4:6]}-{value[6:8]}"
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def detokenize(tokens: list[str]) -> str:
|
| 57 |
+
text = " ".join(t.strip() for t in tokens if t and t.strip())
|
| 58 |
+
for token in NO_SPACE_BEFORE:
|
| 59 |
+
text = text.replace(f" {token}", token)
|
| 60 |
+
for token in NO_SPACE_AFTER:
|
| 61 |
+
text = text.replace(f"{token} ", token)
|
| 62 |
+
return " ".join(text.split()).strip()
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def sentence_text(sentence: ET.Element) -> str:
|
| 66 |
+
tokens = [(t.text or "") for t in sentence.iter("token")]
|
| 67 |
+
return detokenize(tokens)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def iter_sentences(bz2_path: Path):
|
| 71 |
+
current_created = ""
|
| 72 |
+
index = 0
|
| 73 |
+
today = date.today().strftime("%Y-%m-%d")
|
| 74 |
+
with bz2.open(bz2_path, "rb") as f:
|
| 75 |
+
parent_stack: list[ET.Element] = []
|
| 76 |
+
for event, elem in ET.iterparse(f, events=("start", "end")):
|
| 77 |
+
if event == "start":
|
| 78 |
+
parent_stack.append(elem)
|
| 79 |
+
if elem.tag == "text":
|
| 80 |
+
datefrom = elem.attrib.get("datefrom", "")
|
| 81 |
+
dateto = elem.attrib.get("dateto", "")
|
| 82 |
+
current_created = (
|
| 83 |
+
f"{format_date(datefrom)}, {format_date(dateto)}"
|
| 84 |
+
if datefrom and dateto
|
| 85 |
+
else ""
|
| 86 |
+
)
|
| 87 |
+
else:
|
| 88 |
+
if elem.tag == "sentence":
|
| 89 |
+
text = sentence_text(elem)
|
| 90 |
+
if text:
|
| 91 |
+
index += 1
|
| 92 |
+
yield {
|
| 93 |
+
"id": f"{SOURCE}_{index:08d}",
|
| 94 |
+
"text": text,
|
| 95 |
+
"source": SOURCE,
|
| 96 |
+
"added": today,
|
| 97 |
+
"created": current_created,
|
| 98 |
+
}
|
| 99 |
+
if len(parent_stack) >= 2:
|
| 100 |
+
parent_stack[-2].remove(elem)
|
| 101 |
+
elem.clear()
|
| 102 |
+
elif elem.tag in ("text", "paragraph"):
|
| 103 |
+
if len(parent_stack) >= 2:
|
| 104 |
+
parent_stack[-2].remove(elem)
|
| 105 |
+
elem.clear()
|
| 106 |
+
parent_stack.pop()
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def build_dataset(bz2_path: Path) -> Dataset:
|
| 110 |
+
datasets.disable_caching()
|
| 111 |
+
dataset = Dataset.from_generator(lambda: iter_sentences(bz2_path))
|
| 112 |
+
dataset = remove_empty_texts(dataset)
|
| 113 |
+
dataset = remove_duplicate_text(dataset)
|
| 114 |
+
dataset = add_token_count(dataset)
|
| 115 |
+
dataset = ensure_column_order(dataset)
|
| 116 |
+
return dataset
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def main() -> None:
|
| 120 |
+
download_if_needed(XML_URL, CACHE_FILE)
|
| 121 |
+
dataset = build_dataset(CACHE_FILE)
|
| 122 |
+
output_path = Path(__file__).parent / f"{SOURCE}.parquet"
|
| 123 |
+
logger.info("Writing %s rows to %s", len(dataset), output_path)
|
| 124 |
+
dataset.to_parquet(output_path)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
log_path = Path(__file__).parent / f"{SOURCE}.log"
|
| 129 |
+
logging.basicConfig(
|
| 130 |
+
level=logging.INFO,
|
| 131 |
+
format="%(asctime)s - %(levelname)s - %(message)s",
|
| 132 |
+
handlers=[logging.StreamHandler(), logging.FileHandler(log_path)],
|
| 133 |
+
)
|
| 134 |
+
main()
|
data/flashback-kultur/descriptive_stats.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"number_of_samples": 30290455,
|
| 3 |
+
"number_of_tokens": 800007948,
|
| 4 |
+
"min_length_tokens": 2,
|
| 5 |
+
"max_length_tokens": 12196,
|
| 6 |
+
"number_of_characters": 2354106497,
|
| 7 |
+
"min_length_characters": 1,
|
| 8 |
+
"max_length_characters": 65535
|
| 9 |
+
}
|
data/flashback-kultur/flashback-kultur.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: 'Flashback: Culture & Entertainment'
|
| 3 |
+
language:
|
| 4 |
+
- sv
|
| 5 |
+
license: cc-by-4.0
|
| 6 |
+
license_name: CC-BY 4.0
|
| 7 |
+
size_categories:
|
| 8 |
+
- 10M<n<100M
|
| 9 |
+
task_categories:
|
| 10 |
+
- text-generation
|
| 11 |
+
- fill-mask
|
| 12 |
+
task_ids:
|
| 13 |
+
- language-modeling
|
| 14 |
+
source_datasets:
|
| 15 |
+
- original
|
| 16 |
+
domains:
|
| 17 |
+
- Social Media
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# Dataset Card for Flashback: Culture & Entertainment
|
| 21 |
+
|
| 22 |
+
<!-- START-SHORT DESCRIPTION -->
|
| 23 |
+
Sentences from the Culture & Entertainment subforum of [Flashback](https://www.flashback.org), a large Swedish internet forum.
|
| 24 |
+
<!-- END-SHORT DESCRIPTION -->
|
| 25 |
+
|
| 26 |
+
This subset contains sentences from the Culture & Entertainment subforum of Flashback, one of Sweden's largest internet forums. Each sample corresponds to a single sentence — the source corpus supplies sentences in scrambled order for copyright and privacy reasons, so the original post context is not recoverable.
|
| 27 |
+
|
| 28 |
+
## Dataset Description
|
| 29 |
+
|
| 30 |
+
<!-- START-DESC-STATS -->
|
| 31 |
+
- **Number of samples**: 30.29M
|
| 32 |
+
- **Number of tokens (Llama 3)**: 800.01M
|
| 33 |
+
- **Average document length in tokens (min, max)**: 26.41 (2, 12.20K)
|
| 34 |
+
<!-- END-DESC-STATS -->
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
## Dataset Structure
|
| 38 |
+
An example from the dataset looks as follows.
|
| 39 |
+
|
| 40 |
+
<!-- START-SAMPLE -->
|
| 41 |
+
```py
|
| 42 |
+
{
|
| 43 |
+
"id": "flashback-kultur_00000001",
|
| 44 |
+
"text": "Finns ju en hel del företag som trycker små upplagor och säljer åt dig.",
|
| 45 |
+
"source": "flashback-kultur",
|
| 46 |
+
"added": "2026-05-30",
|
| 47 |
+
"created": "2010-06-09, 2010-06-09",
|
| 48 |
+
"token_count": 26
|
| 49 |
+
}
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
### Data Fields
|
| 53 |
+
|
| 54 |
+
An entry in the dataset consists of the following fields:
|
| 55 |
+
|
| 56 |
+
- `id` (`str`): A unique identifier for each document.
|
| 57 |
+
- `text` (`str`): The content of the document.
|
| 58 |
+
- `source` (`str`): The source of the document (see [Source Data](#source-data)).
|
| 59 |
+
- `added` (`str`): The date when the document was added to this collection.
|
| 60 |
+
- `created` (`str`): The date range when the document was originally created.
|
| 61 |
+
- `token_count` (`int`): The number of tokens in the sample computed using the Llama 3 tokenizer.
|
| 62 |
+
<!-- END-SAMPLE -->
|
| 63 |
+
|
| 64 |
+
### Dataset Statistics
|
| 65 |
+
|
| 66 |
+
<!-- START-DATASET PLOTS -->
|
| 67 |
+
<p align="center">
|
| 68 |
+
<img src="./images/dist_document_length.png" width="600" style="margin-right: 10px;" />
|
| 69 |
+
</p>
|
| 70 |
+
<!-- END-DATASET PLOTS -->
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
## Additional Information
|
| 74 |
+
|
| 75 |
+
### Limitations
|
| 76 |
+
|
| 77 |
+
Each sample is a single sentence. The source corpus deliberately scrambles sentence order for copyright and privacy protection, so the original post context is not recoverable.
|
| 78 |
+
|
| 79 |
+
The source material is tokenized and does not preserve the original spacing between tokens. We approximate readable spacing when reconstructing plain text.
|
| 80 |
+
|
| 81 |
+
As a forum corpus, this material contains informal, colloquial, and potentially offensive language.
|
| 82 |
+
|
| 83 |
+
### Source
|
| 84 |
+
|
| 85 |
+
We download the corpus from Språkbanken Text's official source file for *Flashback: Culture & Entertainment*.
|
| 86 |
+
|
| 87 |
+
### Citation Information
|
| 88 |
+
|
| 89 |
+
If you use this subset, cite the original source release:
|
| 90 |
+
|
| 91 |
+
> Språkbanken Text (2025). Flashback: Culture & Entertainment (updated: 2025-04-01). [Data set]. Språkbanken Text.
|
| 92 |
+
|
| 93 |
+
## License Information
|
| 94 |
+
|
| 95 |
+
The source corpus is distributed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
data/flashback-kultur/flashback-kultur.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a9a125aa90a76b99a4605e107f2f150ee94e23fd4067eac8a84d5c38caa6b48e
|
| 3 |
+
size 1951741502
|
data/flashback-kultur/images/dist_document_length.png
ADDED
|
Git LFS Details
|
data/flashback-livsstil/create.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /// script
|
| 2 |
+
# requires-python = ">=3.12"
|
| 3 |
+
# dependencies = [
|
| 4 |
+
# "datasets>=3.0.0",
|
| 5 |
+
# "dynaword",
|
| 6 |
+
# "pydantic>=2.10.4",
|
| 7 |
+
# "transformers>=4.47.1",
|
| 8 |
+
# ]
|
| 9 |
+
#
|
| 10 |
+
# [tool.uv.sources]
|
| 11 |
+
# dynaword = { path = "../.." }
|
| 12 |
+
# ///
|
| 13 |
+
|
| 14 |
+
"""Download and process Språkbanken Text's `flashback-livsstil` corpus."""
|
| 15 |
+
|
| 16 |
+
import bz2
|
| 17 |
+
import logging
|
| 18 |
+
import urllib.request
|
| 19 |
+
import xml.etree.ElementTree as ET
|
| 20 |
+
from datetime import date
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
|
| 23 |
+
import datasets
|
| 24 |
+
from datasets import Dataset
|
| 25 |
+
from dynaword.process_dataset import (
|
| 26 |
+
add_token_count,
|
| 27 |
+
ensure_column_order,
|
| 28 |
+
remove_duplicate_text,
|
| 29 |
+
remove_empty_texts,
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
logger = logging.getLogger(__name__)
|
| 33 |
+
|
| 34 |
+
SOURCE = "flashback-livsstil"
|
| 35 |
+
XML_URL = "https://spraakbanken.gu.se/resurser/meningsmangder/flashback-livsstil.xml.bz2"
|
| 36 |
+
CACHE_FILE = Path(__file__).parent / "cache" / "flashback-livsstil.xml.bz2"
|
| 37 |
+
|
| 38 |
+
NO_SPACE_BEFORE = (".", ",", ";", ":", "!", "?", ")", "]", "}", "»")
|
| 39 |
+
NO_SPACE_AFTER = ("(", "[", "{", "«")
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def download_if_needed(url: str, path: Path) -> None:
|
| 43 |
+
if path.exists():
|
| 44 |
+
logger.info("Using cached %s", path)
|
| 45 |
+
return
|
| 46 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 47 |
+
logger.info("Downloading %s to %s", url, path)
|
| 48 |
+
urllib.request.urlretrieve(url, path)
|
| 49 |
+
logger.info("Download complete")
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def format_date(value: str) -> str:
|
| 53 |
+
return f"{value[:4]}-{value[4:6]}-{value[6:8]}"
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def detokenize(tokens: list[str]) -> str:
|
| 57 |
+
text = " ".join(t.strip() for t in tokens if t and t.strip())
|
| 58 |
+
for token in NO_SPACE_BEFORE:
|
| 59 |
+
text = text.replace(f" {token}", token)
|
| 60 |
+
for token in NO_SPACE_AFTER:
|
| 61 |
+
text = text.replace(f"{token} ", token)
|
| 62 |
+
return " ".join(text.split()).strip()
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def sentence_text(sentence: ET.Element) -> str:
|
| 66 |
+
tokens = [(t.text or "") for t in sentence.iter("token")]
|
| 67 |
+
return detokenize(tokens)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def iter_sentences(bz2_path: Path):
|
| 71 |
+
current_created = ""
|
| 72 |
+
index = 0
|
| 73 |
+
today = date.today().strftime("%Y-%m-%d")
|
| 74 |
+
with bz2.open(bz2_path, "rb") as f:
|
| 75 |
+
parent_stack: list[ET.Element] = []
|
| 76 |
+
for event, elem in ET.iterparse(f, events=("start", "end")):
|
| 77 |
+
if event == "start":
|
| 78 |
+
parent_stack.append(elem)
|
| 79 |
+
if elem.tag == "text":
|
| 80 |
+
datefrom = elem.attrib.get("datefrom", "")
|
| 81 |
+
dateto = elem.attrib.get("dateto", "")
|
| 82 |
+
current_created = (
|
| 83 |
+
f"{format_date(datefrom)}, {format_date(dateto)}"
|
| 84 |
+
if datefrom and dateto
|
| 85 |
+
else ""
|
| 86 |
+
)
|
| 87 |
+
else:
|
| 88 |
+
if elem.tag == "sentence":
|
| 89 |
+
text = sentence_text(elem)
|
| 90 |
+
if text:
|
| 91 |
+
index += 1
|
| 92 |
+
yield {
|
| 93 |
+
"id": f"{SOURCE}_{index:08d}",
|
| 94 |
+
"text": text,
|
| 95 |
+
"source": SOURCE,
|
| 96 |
+
"added": today,
|
| 97 |
+
"created": current_created,
|
| 98 |
+
}
|
| 99 |
+
if len(parent_stack) >= 2:
|
| 100 |
+
parent_stack[-2].remove(elem)
|
| 101 |
+
elem.clear()
|
| 102 |
+
elif elem.tag in ("text", "paragraph"):
|
| 103 |
+
if len(parent_stack) >= 2:
|
| 104 |
+
parent_stack[-2].remove(elem)
|
| 105 |
+
elem.clear()
|
| 106 |
+
parent_stack.pop()
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def build_dataset(bz2_path: Path) -> Dataset:
|
| 110 |
+
datasets.disable_caching()
|
| 111 |
+
dataset = Dataset.from_generator(lambda: iter_sentences(bz2_path))
|
| 112 |
+
dataset = remove_empty_texts(dataset)
|
| 113 |
+
dataset = remove_duplicate_text(dataset)
|
| 114 |
+
dataset = add_token_count(dataset)
|
| 115 |
+
dataset = ensure_column_order(dataset)
|
| 116 |
+
return dataset
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def main() -> None:
|
| 120 |
+
download_if_needed(XML_URL, CACHE_FILE)
|
| 121 |
+
dataset = build_dataset(CACHE_FILE)
|
| 122 |
+
output_path = Path(__file__).parent / f"{SOURCE}.parquet"
|
| 123 |
+
logger.info("Writing %s rows to %s", len(dataset), output_path)
|
| 124 |
+
dataset.to_parquet(output_path)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
log_path = Path(__file__).parent / f"{SOURCE}.log"
|
| 129 |
+
logging.basicConfig(
|
| 130 |
+
level=logging.INFO,
|
| 131 |
+
format="%(asctime)s - %(levelname)s - %(message)s",
|
| 132 |
+
handlers=[logging.StreamHandler(), logging.FileHandler(log_path)],
|
| 133 |
+
)
|
| 134 |
+
main()
|
data/flashback-livsstil/descriptive_stats.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"number_of_samples": 7218279,
|
| 3 |
+
"number_of_tokens": 189249970,
|
| 4 |
+
"min_length_tokens": 2,
|
| 5 |
+
"max_length_tokens": 7263,
|
| 6 |
+
"number_of_characters": 538261456,
|
| 7 |
+
"min_length_characters": 1,
|
| 8 |
+
"max_length_characters": 12003
|
| 9 |
+
}
|
data/flashback-livsstil/flashback-livsstil.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: 'Flashback: Lifestyle'
|
| 3 |
+
language:
|
| 4 |
+
- sv
|
| 5 |
+
license: cc-by-4.0
|
| 6 |
+
license_name: CC-BY 4.0
|
| 7 |
+
size_categories:
|
| 8 |
+
- 1M<n<10M
|
| 9 |
+
task_categories:
|
| 10 |
+
- text-generation
|
| 11 |
+
- fill-mask
|
| 12 |
+
task_ids:
|
| 13 |
+
- language-modeling
|
| 14 |
+
source_datasets:
|
| 15 |
+
- original
|
| 16 |
+
domains:
|
| 17 |
+
- Social Media
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# Dataset Card for Flashback: Lifestyle
|
| 21 |
+
|
| 22 |
+
<!-- START-SHORT DESCRIPTION -->
|
| 23 |
+
Sentences from the Lifestyle subforum of [Flashback](https://www.flashback.org), a large Swedish internet forum.
|
| 24 |
+
<!-- END-SHORT DESCRIPTION -->
|
| 25 |
+
|
| 26 |
+
This subset contains sentences from the Lifestyle subforum of Flashback, one of Sweden's largest internet forums. Each sample corresponds to a single sentence — the source corpus supplies sentences in scrambled order for copyright and privacy reasons, so the original post context is not recoverable.
|
| 27 |
+
|
| 28 |
+
## Dataset Description
|
| 29 |
+
|
| 30 |
+
<!-- START-DESC-STATS -->
|
| 31 |
+
- **Number of samples**: 7.22M
|
| 32 |
+
- **Number of tokens (Llama 3)**: 189.25M
|
| 33 |
+
- **Average document length in tokens (min, max)**: 26.22 (2, 7.26K)
|
| 34 |
+
<!-- END-DESC-STATS -->
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
## Dataset Structure
|
| 38 |
+
An example from the dataset looks as follows.
|
| 39 |
+
|
| 40 |
+
<!-- START-SAMPLE -->
|
| 41 |
+
```py
|
| 42 |
+
{
|
| 43 |
+
"id": "flashback-livsstil_00000001",
|
| 44 |
+
"text": "The Horror!",
|
| 45 |
+
"source": "flashback-livsstil",
|
| 46 |
+
"added": "2026-05-30",
|
| 47 |
+
"created": "2013-04-12, 2013-04-12",
|
| 48 |
+
"token_count": 4
|
| 49 |
+
}
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
### Data Fields
|
| 53 |
+
|
| 54 |
+
An entry in the dataset consists of the following fields:
|
| 55 |
+
|
| 56 |
+
- `id` (`str`): A unique identifier for each document.
|
| 57 |
+
- `text` (`str`): The content of the document.
|
| 58 |
+
- `source` (`str`): The source of the document (see [Source Data](#source-data)).
|
| 59 |
+
- `added` (`str`): The date when the document was added to this collection.
|
| 60 |
+
- `created` (`str`): The date range when the document was originally created.
|
| 61 |
+
- `token_count` (`int`): The number of tokens in the sample computed using the Llama 3 tokenizer.
|
| 62 |
+
<!-- END-SAMPLE -->
|
| 63 |
+
|
| 64 |
+
### Dataset Statistics
|
| 65 |
+
|
| 66 |
+
<!-- START-DATASET PLOTS -->
|
| 67 |
+
<p align="center">
|
| 68 |
+
<img src="./images/dist_document_length.png" width="600" style="margin-right: 10px;" />
|
| 69 |
+
</p>
|
| 70 |
+
<!-- END-DATASET PLOTS -->
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
## Additional Information
|
| 74 |
+
|
| 75 |
+
### Limitations
|
| 76 |
+
|
| 77 |
+
Each sample is a single sentence. The source corpus deliberately scrambles sentence order for copyright and privacy protection, so the original post context is not recoverable.
|
| 78 |
+
|
| 79 |
+
The source material is tokenized and does not preserve the original spacing between tokens. We approximate readable spacing when reconstructing plain text.
|
| 80 |
+
|
| 81 |
+
As a forum corpus, this material contains informal, colloquial, and potentially offensive language.
|
| 82 |
+
|
| 83 |
+
### Source
|
| 84 |
+
|
| 85 |
+
We download the corpus from Språkbanken Text's official source file for *Flashback: Lifestyle*.
|
| 86 |
+
|
| 87 |
+
### Citation Information
|
| 88 |
+
|
| 89 |
+
If you use this subset, cite the original source release:
|
| 90 |
+
|
| 91 |
+
> Språkbanken Text (2025). Flashback: Lifestyle (updated: 2025-04-01). [Data set]. Språkbanken Text.
|
| 92 |
+
|
| 93 |
+
## License Information
|
| 94 |
+
|
| 95 |
+
The source corpus is distributed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
data/flashback-livsstil/flashback-livsstil.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4267b30a63172d5edeea130a5a27d8a762d15b1b9c5c3c9fef308e613741a577
|
| 3 |
+
size 446804334
|
data/flashback-livsstil/images/dist_document_length.png
ADDED
|
Git LFS Details
|
data/flashback-ovrigt/create.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /// script
|
| 2 |
+
# requires-python = ">=3.12"
|
| 3 |
+
# dependencies = [
|
| 4 |
+
# "datasets>=3.0.0",
|
| 5 |
+
# "dynaword",
|
| 6 |
+
# "pydantic>=2.10.4",
|
| 7 |
+
# "transformers>=4.47.1",
|
| 8 |
+
# ]
|
| 9 |
+
#
|
| 10 |
+
# [tool.uv.sources]
|
| 11 |
+
# dynaword = { path = "../.." }
|
| 12 |
+
# ///
|
| 13 |
+
|
| 14 |
+
"""Download and process Språkbanken Text's `flashback-ovrigt` corpus."""
|
| 15 |
+
|
| 16 |
+
import bz2
|
| 17 |
+
import logging
|
| 18 |
+
import urllib.request
|
| 19 |
+
import xml.etree.ElementTree as ET
|
| 20 |
+
from datetime import date
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
|
| 23 |
+
import datasets
|
| 24 |
+
from datasets import Dataset
|
| 25 |
+
from dynaword.process_dataset import (
|
| 26 |
+
add_token_count,
|
| 27 |
+
ensure_column_order,
|
| 28 |
+
remove_duplicate_text,
|
| 29 |
+
remove_empty_texts,
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
logger = logging.getLogger(__name__)
|
| 33 |
+
|
| 34 |
+
SOURCE = "flashback-ovrigt"
|
| 35 |
+
XML_URL = "https://spraakbanken.gu.se/resurser/meningsmangder/flashback-ovrigt.xml.bz2"
|
| 36 |
+
CACHE_FILE = Path(__file__).parent / "cache" / "flashback-ovrigt.xml.bz2"
|
| 37 |
+
|
| 38 |
+
NO_SPACE_BEFORE = (".", ",", ";", ":", "!", "?", ")", "]", "}", "»")
|
| 39 |
+
NO_SPACE_AFTER = ("(", "[", "{", "«")
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def download_if_needed(url: str, path: Path) -> None:
|
| 43 |
+
if path.exists():
|
| 44 |
+
logger.info("Using cached %s", path)
|
| 45 |
+
return
|
| 46 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 47 |
+
logger.info("Downloading %s to %s", url, path)
|
| 48 |
+
urllib.request.urlretrieve(url, path)
|
| 49 |
+
logger.info("Download complete")
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def format_date(value: str) -> str:
|
| 53 |
+
return f"{value[:4]}-{value[4:6]}-{value[6:8]}"
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def detokenize(tokens: list[str]) -> str:
|
| 57 |
+
text = " ".join(t.strip() for t in tokens if t and t.strip())
|
| 58 |
+
for token in NO_SPACE_BEFORE:
|
| 59 |
+
text = text.replace(f" {token}", token)
|
| 60 |
+
for token in NO_SPACE_AFTER:
|
| 61 |
+
text = text.replace(f"{token} ", token)
|
| 62 |
+
return " ".join(text.split()).strip()
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def sentence_text(sentence: ET.Element) -> str:
|
| 66 |
+
tokens = [(t.text or "") for t in sentence.iter("token")]
|
| 67 |
+
return detokenize(tokens)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def iter_sentences(bz2_path: Path):
|
| 71 |
+
current_created = ""
|
| 72 |
+
index = 0
|
| 73 |
+
today = date.today().strftime("%Y-%m-%d")
|
| 74 |
+
with bz2.open(bz2_path, "rb") as f:
|
| 75 |
+
parent_stack: list[ET.Element] = []
|
| 76 |
+
for event, elem in ET.iterparse(f, events=("start", "end")):
|
| 77 |
+
if event == "start":
|
| 78 |
+
parent_stack.append(elem)
|
| 79 |
+
if elem.tag == "text":
|
| 80 |
+
datefrom = elem.attrib.get("datefrom", "")
|
| 81 |
+
dateto = elem.attrib.get("dateto", "")
|
| 82 |
+
current_created = (
|
| 83 |
+
f"{format_date(datefrom)}, {format_date(dateto)}"
|
| 84 |
+
if datefrom and dateto
|
| 85 |
+
else ""
|
| 86 |
+
)
|
| 87 |
+
else:
|
| 88 |
+
if elem.tag == "sentence":
|
| 89 |
+
text = sentence_text(elem)
|
| 90 |
+
if text:
|
| 91 |
+
index += 1
|
| 92 |
+
yield {
|
| 93 |
+
"id": f"{SOURCE}_{index:08d}",
|
| 94 |
+
"text": text,
|
| 95 |
+
"source": SOURCE,
|
| 96 |
+
"added": today,
|
| 97 |
+
"created": current_created,
|
| 98 |
+
}
|
| 99 |
+
if len(parent_stack) >= 2:
|
| 100 |
+
parent_stack[-2].remove(elem)
|
| 101 |
+
elem.clear()
|
| 102 |
+
elif elem.tag in ("text", "paragraph"):
|
| 103 |
+
if len(parent_stack) >= 2:
|
| 104 |
+
parent_stack[-2].remove(elem)
|
| 105 |
+
elem.clear()
|
| 106 |
+
parent_stack.pop()
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def build_dataset(bz2_path: Path) -> Dataset:
|
| 110 |
+
datasets.disable_caching()
|
| 111 |
+
dataset = Dataset.from_generator(lambda: iter_sentences(bz2_path))
|
| 112 |
+
dataset = remove_empty_texts(dataset)
|
| 113 |
+
dataset = remove_duplicate_text(dataset)
|
| 114 |
+
dataset = add_token_count(dataset)
|
| 115 |
+
dataset = ensure_column_order(dataset)
|
| 116 |
+
return dataset
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def main() -> None:
|
| 120 |
+
download_if_needed(XML_URL, CACHE_FILE)
|
| 121 |
+
dataset = build_dataset(CACHE_FILE)
|
| 122 |
+
output_path = Path(__file__).parent / f"{SOURCE}.parquet"
|
| 123 |
+
logger.info("Writing %s rows to %s", len(dataset), output_path)
|
| 124 |
+
dataset.to_parquet(output_path)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
log_path = Path(__file__).parent / f"{SOURCE}.log"
|
| 129 |
+
logging.basicConfig(
|
| 130 |
+
level=logging.INFO,
|
| 131 |
+
format="%(asctime)s - %(levelname)s - %(message)s",
|
| 132 |
+
handlers=[logging.StreamHandler(), logging.FileHandler(log_path)],
|
| 133 |
+
)
|
| 134 |
+
main()
|
data/flashback-ovrigt/descriptive_stats.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"number_of_samples": 10596020,
|
| 3 |
+
"number_of_tokens": 278091459,
|
| 4 |
+
"min_length_tokens": 2,
|
| 5 |
+
"max_length_tokens": 20423,
|
| 6 |
+
"number_of_characters": 807674760,
|
| 7 |
+
"min_length_characters": 1,
|
| 8 |
+
"max_length_characters": 68505
|
| 9 |
+
}
|
data/flashback-ovrigt/flashback-ovrigt.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: 'Flashback: Other'
|
| 3 |
+
language:
|
| 4 |
+
- sv
|
| 5 |
+
license: cc-by-4.0
|
| 6 |
+
license_name: CC-BY 4.0
|
| 7 |
+
size_categories:
|
| 8 |
+
- 10M<n<100M
|
| 9 |
+
task_categories:
|
| 10 |
+
- text-generation
|
| 11 |
+
- fill-mask
|
| 12 |
+
task_ids:
|
| 13 |
+
- language-modeling
|
| 14 |
+
source_datasets:
|
| 15 |
+
- original
|
| 16 |
+
domains:
|
| 17 |
+
- Social Media
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# Dataset Card for Flashback: Other
|
| 21 |
+
|
| 22 |
+
<!-- START-SHORT DESCRIPTION -->
|
| 23 |
+
Sentences from the Other subforum of [Flashback](https://www.flashback.org), a large Swedish internet forum.
|
| 24 |
+
<!-- END-SHORT DESCRIPTION -->
|
| 25 |
+
|
| 26 |
+
This subset contains sentences from the Other subforum of Flashback, one of Sweden's largest internet forums. Each sample corresponds to a single sentence — the source corpus supplies sentences in scrambled order for copyright and privacy reasons, so the original post context is not recoverable.
|
| 27 |
+
|
| 28 |
+
## Dataset Description
|
| 29 |
+
|
| 30 |
+
<!-- START-DESC-STATS -->
|
| 31 |
+
- **Number of samples**: 10.60M
|
| 32 |
+
- **Number of tokens (Llama 3)**: 278.09M
|
| 33 |
+
- **Average document length in tokens (min, max)**: 26.24 (2, 20.42K)
|
| 34 |
+
<!-- END-DESC-STATS -->
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
## Dataset Structure
|
| 38 |
+
An example from the dataset looks as follows.
|
| 39 |
+
|
| 40 |
+
<!-- START-SAMPLE -->
|
| 41 |
+
```py
|
| 42 |
+
{
|
| 43 |
+
"id": "flashback-ovrigt_00000001",
|
| 44 |
+
"text": "Så slutligen ytterligare en fråga, hur ska han få reda på om det är sant?",
|
| 45 |
+
"source": "flashback-ovrigt",
|
| 46 |
+
"added": "2026-07-19",
|
| 47 |
+
"created": "2006-07-31, 2006-07-31",
|
| 48 |
+
"token_count": 27
|
| 49 |
+
}
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
### Data Fields
|
| 53 |
+
|
| 54 |
+
An entry in the dataset consists of the following fields:
|
| 55 |
+
|
| 56 |
+
- `id` (`str`): A unique identifier for each document.
|
| 57 |
+
- `text` (`str`): The content of the document.
|
| 58 |
+
- `source` (`str`): The source of the document (see [Source Data](#source-data)).
|
| 59 |
+
- `added` (`str`): The date when the document was added to this collection.
|
| 60 |
+
- `created` (`str`): The date range when the document was originally created.
|
| 61 |
+
- `token_count` (`int`): The number of tokens in the sample computed using the Llama 3 tokenizer.
|
| 62 |
+
<!-- END-SAMPLE -->
|
| 63 |
+
|
| 64 |
+
### Dataset Statistics
|
| 65 |
+
|
| 66 |
+
<!-- START-DATASET PLOTS -->
|
| 67 |
+
<p align="center">
|
| 68 |
+
<img src="./images/dist_document_length.png" width="600" style="margin-right: 10px;" />
|
| 69 |
+
</p>
|
| 70 |
+
<!-- END-DATASET PLOTS -->
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
## Additional Information
|
| 74 |
+
|
| 75 |
+
### Limitations
|
| 76 |
+
|
| 77 |
+
Each sample is a single sentence. The source corpus deliberately scrambles sentence order for copyright and privacy protection, so the original post context is not recoverable.
|
| 78 |
+
|
| 79 |
+
The source material is tokenized and does not preserve the original spacing between tokens. We approximate readable spacing when reconstructing plain text.
|
| 80 |
+
|
| 81 |
+
As a forum corpus, this material contains informal, colloquial, and potentially offensive language.
|
| 82 |
+
|
| 83 |
+
### Source
|
| 84 |
+
|
| 85 |
+
We download the corpus from Språkbanken Text's official source file for *Flashback: Other*.
|
| 86 |
+
|
| 87 |
+
### Citation Information
|
| 88 |
+
|
| 89 |
+
If you use this subset, cite the original source release:
|
| 90 |
+
|
| 91 |
+
> Språkbanken Text (2025). Flashback: Other (updated: 2025-04-01). [Data set]. Språkbanken Text.
|
| 92 |
+
|
| 93 |
+
## License Information
|
| 94 |
+
|
| 95 |
+
The source corpus is distributed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
data/flashback-ovrigt/flashback-ovrigt.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7b5d6cea5a6975314828c6f8a2577a9284dcc3dc2e3aba5ee1a97bf43b21f362
|
| 3 |
+
size 668465348
|
data/flashback-ovrigt/images/dist_document_length.png
ADDED
|
Git LFS Details
|
data/flashback-politik/create.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /// script
|
| 2 |
+
# requires-python = ">=3.12"
|
| 3 |
+
# dependencies = [
|
| 4 |
+
# "datasets>=3.0.0",
|
| 5 |
+
# "dynaword",
|
| 6 |
+
# "pydantic>=2.10.4",
|
| 7 |
+
# "transformers>=4.47.1",
|
| 8 |
+
# ]
|
| 9 |
+
#
|
| 10 |
+
# [tool.uv.sources]
|
| 11 |
+
# dynaword = { path = "../.." }
|
| 12 |
+
# ///
|
| 13 |
+
|
| 14 |
+
"""Download and process Språkbanken Text's `flashback-politik` corpus."""
|
| 15 |
+
|
| 16 |
+
import bz2
|
| 17 |
+
import logging
|
| 18 |
+
import urllib.request
|
| 19 |
+
import xml.etree.ElementTree as ET
|
| 20 |
+
from datetime import date
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
|
| 23 |
+
import datasets
|
| 24 |
+
from datasets import Dataset
|
| 25 |
+
from dynaword.process_dataset import (
|
| 26 |
+
add_token_count,
|
| 27 |
+
ensure_column_order,
|
| 28 |
+
remove_duplicate_text,
|
| 29 |
+
remove_empty_texts,
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
logger = logging.getLogger(__name__)
|
| 33 |
+
|
| 34 |
+
SOURCE = "flashback-politik"
|
| 35 |
+
XML_URL = "https://spraakbanken.gu.se/resurser/meningsmangder/flashback-politik.xml.bz2"
|
| 36 |
+
CACHE_FILE = Path(__file__).parent / "cache" / "flashback-politik.xml.bz2"
|
| 37 |
+
|
| 38 |
+
NO_SPACE_BEFORE = (".", ",", ";", ":", "!", "?", ")", "]", "}", "»")
|
| 39 |
+
NO_SPACE_AFTER = ("(", "[", "{", "«")
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def download_if_needed(url: str, path: Path) -> None:
|
| 43 |
+
if path.exists():
|
| 44 |
+
logger.info("Using cached %s", path)
|
| 45 |
+
return
|
| 46 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 47 |
+
logger.info("Downloading %s to %s", url, path)
|
| 48 |
+
urllib.request.urlretrieve(url, path)
|
| 49 |
+
logger.info("Download complete")
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def format_date(value: str) -> str:
|
| 53 |
+
return f"{value[:4]}-{value[4:6]}-{value[6:8]}"
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def detokenize(tokens: list[str]) -> str:
|
| 57 |
+
text = " ".join(t.strip() for t in tokens if t and t.strip())
|
| 58 |
+
for token in NO_SPACE_BEFORE:
|
| 59 |
+
text = text.replace(f" {token}", token)
|
| 60 |
+
for token in NO_SPACE_AFTER:
|
| 61 |
+
text = text.replace(f"{token} ", token)
|
| 62 |
+
return " ".join(text.split()).strip()
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def sentence_text(sentence: ET.Element) -> str:
|
| 66 |
+
tokens = [(t.text or "") for t in sentence.iter("token")]
|
| 67 |
+
return detokenize(tokens)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def iter_sentences(bz2_path: Path):
|
| 71 |
+
current_created = ""
|
| 72 |
+
index = 0
|
| 73 |
+
today = date.today().strftime("%Y-%m-%d")
|
| 74 |
+
with bz2.open(bz2_path, "rb") as f:
|
| 75 |
+
parent_stack: list[ET.Element] = []
|
| 76 |
+
for event, elem in ET.iterparse(f, events=("start", "end")):
|
| 77 |
+
if event == "start":
|
| 78 |
+
parent_stack.append(elem)
|
| 79 |
+
if elem.tag == "text":
|
| 80 |
+
datefrom = elem.attrib.get("datefrom", "")
|
| 81 |
+
dateto = elem.attrib.get("dateto", "")
|
| 82 |
+
current_created = (
|
| 83 |
+
f"{format_date(datefrom)}, {format_date(dateto)}"
|
| 84 |
+
if datefrom and dateto
|
| 85 |
+
else ""
|
| 86 |
+
)
|
| 87 |
+
else:
|
| 88 |
+
if elem.tag == "sentence":
|
| 89 |
+
text = sentence_text(elem)
|
| 90 |
+
if text:
|
| 91 |
+
index += 1
|
| 92 |
+
yield {
|
| 93 |
+
"id": f"{SOURCE}_{index:08d}",
|
| 94 |
+
"text": text,
|
| 95 |
+
"source": SOURCE,
|
| 96 |
+
"added": today,
|
| 97 |
+
"created": current_created,
|
| 98 |
+
}
|
| 99 |
+
if len(parent_stack) >= 2:
|
| 100 |
+
parent_stack[-2].remove(elem)
|
| 101 |
+
elem.clear()
|
| 102 |
+
elif elem.tag in ("text", "paragraph"):
|
| 103 |
+
if len(parent_stack) >= 2:
|
| 104 |
+
parent_stack[-2].remove(elem)
|
| 105 |
+
elem.clear()
|
| 106 |
+
parent_stack.pop()
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def build_dataset(bz2_path: Path) -> Dataset:
|
| 110 |
+
datasets.disable_caching()
|
| 111 |
+
dataset = Dataset.from_generator(lambda: iter_sentences(bz2_path))
|
| 112 |
+
dataset = remove_empty_texts(dataset)
|
| 113 |
+
dataset = remove_duplicate_text(dataset)
|
| 114 |
+
dataset = add_token_count(dataset)
|
| 115 |
+
dataset = ensure_column_order(dataset)
|
| 116 |
+
return dataset
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def main() -> None:
|
| 120 |
+
download_if_needed(XML_URL, CACHE_FILE)
|
| 121 |
+
dataset = build_dataset(CACHE_FILE)
|
| 122 |
+
output_path = Path(__file__).parent / f"{SOURCE}.parquet"
|
| 123 |
+
logger.info("Writing %s rows to %s", len(dataset), output_path)
|
| 124 |
+
dataset.to_parquet(output_path)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
log_path = Path(__file__).parent / f"{SOURCE}.log"
|
| 129 |
+
logging.basicConfig(
|
| 130 |
+
level=logging.INFO,
|
| 131 |
+
format="%(asctime)s - %(levelname)s - %(message)s",
|
| 132 |
+
handlers=[logging.StreamHandler(), logging.FileHandler(log_path)],
|
| 133 |
+
)
|
| 134 |
+
main()
|
data/flashback-politik/descriptive_stats.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"number_of_samples": 49832288,
|
| 3 |
+
"number_of_tokens": 1490319132,
|
| 4 |
+
"min_length_tokens": 2,
|
| 5 |
+
"max_length_tokens": 65308,
|
| 6 |
+
"number_of_characters": 4458096811,
|
| 7 |
+
"min_length_characters": 1,
|
| 8 |
+
"max_length_characters": 130613
|
| 9 |
+
}
|
data/flashback-politik/flashback-politik.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: 'Flashback: Politics'
|
| 3 |
+
language:
|
| 4 |
+
- sv
|
| 5 |
+
license: cc-by-4.0
|
| 6 |
+
license_name: CC-BY 4.0
|
| 7 |
+
size_categories:
|
| 8 |
+
- 10M<n<100M
|
| 9 |
+
task_categories:
|
| 10 |
+
- text-generation
|
| 11 |
+
- fill-mask
|
| 12 |
+
task_ids:
|
| 13 |
+
- language-modeling
|
| 14 |
+
source_datasets:
|
| 15 |
+
- original
|
| 16 |
+
domains:
|
| 17 |
+
- Social Media
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# Dataset Card for Flashback: Politics
|
| 21 |
+
|
| 22 |
+
<!-- START-SHORT DESCRIPTION -->
|
| 23 |
+
Sentences from the Politics subforum of [Flashback](https://www.flashback.org), a large Swedish internet forum.
|
| 24 |
+
<!-- END-SHORT DESCRIPTION -->
|
| 25 |
+
|
| 26 |
+
This subset contains sentences from the Politics subforum of Flashback, one of Sweden's largest internet forums. Each sample corresponds to a single sentence — the source corpus supplies sentences in scrambled order for copyright and privacy reasons, so the original post context is not recoverable.
|
| 27 |
+
|
| 28 |
+
## Dataset Description
|
| 29 |
+
|
| 30 |
+
<!-- START-DESC-STATS -->
|
| 31 |
+
- **Number of samples**: 49.83M
|
| 32 |
+
- **Number of tokens (Llama 3)**: 1.49B
|
| 33 |
+
- **Average document length in tokens (min, max)**: 29.91 (2, 65.31K)
|
| 34 |
+
<!-- END-DESC-STATS -->
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
## Dataset Structure
|
| 38 |
+
An example from the dataset looks as follows.
|
| 39 |
+
|
| 40 |
+
<!-- START-SAMPLE -->
|
| 41 |
+
```py
|
| 42 |
+
{
|
| 43 |
+
"id": "flashback-politik_00000001",
|
| 44 |
+
"text": "Sedan begriper jag förstås att rekreationsbruk av cannabis inte är missbruk eller självmedicinering.",
|
| 45 |
+
"source": "flashback-politik",
|
| 46 |
+
"added": "2026-05-30",
|
| 47 |
+
"created": "2018-10-28, 2018-10-28",
|
| 48 |
+
"token_count": 33
|
| 49 |
+
}
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
### Data Fields
|
| 53 |
+
|
| 54 |
+
An entry in the dataset consists of the following fields:
|
| 55 |
+
|
| 56 |
+
- `id` (`str`): A unique identifier for each document.
|
| 57 |
+
- `text` (`str`): The content of the document.
|
| 58 |
+
- `source` (`str`): The source of the document (see [Source Data](#source-data)).
|
| 59 |
+
- `added` (`str`): The date when the document was added to this collection.
|
| 60 |
+
- `created` (`str`): The date range when the document was originally created.
|
| 61 |
+
- `token_count` (`int`): The number of tokens in the sample computed using the Llama 3 tokenizer.
|
| 62 |
+
<!-- END-SAMPLE -->
|
| 63 |
+
|
| 64 |
+
### Dataset Statistics
|
| 65 |
+
|
| 66 |
+
<!-- START-DATASET PLOTS -->
|
| 67 |
+
<p align="center">
|
| 68 |
+
<img src="./images/dist_document_length.png" width="600" style="margin-right: 10px;" />
|
| 69 |
+
</p>
|
| 70 |
+
<!-- END-DATASET PLOTS -->
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
## Additional Information
|
| 74 |
+
|
| 75 |
+
### Limitations
|
| 76 |
+
|
| 77 |
+
Each sample is a single sentence. The source corpus deliberately scrambles sentence order for copyright and privacy protection, so the original post context is not recoverable.
|
| 78 |
+
|
| 79 |
+
The source material is tokenized and does not preserve the original spacing between tokens. We approximate readable spacing when reconstructing plain text.
|
| 80 |
+
|
| 81 |
+
As a forum corpus, this material contains informal, colloquial, and potentially offensive language.
|
| 82 |
+
|
| 83 |
+
### Source
|
| 84 |
+
|
| 85 |
+
We download the corpus from Språkbanken Text's official source file for *Flashback: Politics*.
|
| 86 |
+
|
| 87 |
+
### Citation Information
|
| 88 |
+
|
| 89 |
+
If you use this subset, cite the original source release:
|
| 90 |
+
|
| 91 |
+
> Språkbanken Text (2025). Flashback: Politics (updated: 2025-04-01). [Data set]. Språkbanken Text.
|
| 92 |
+
|
| 93 |
+
## License Information
|
| 94 |
+
|
| 95 |
+
The source corpus is distributed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
data/flashback-politik/flashback-politik.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:20394f8cd43189a573913a148cb22dac247687a6b42674996d9afdd9f0aaaf1f
|
| 3 |
+
size 3567073575
|
data/flashback-politik/images/dist_document_length.png
ADDED
|
Git LFS Details
|
data/flashback-samhalle/create.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /// script
|
| 2 |
+
# requires-python = ">=3.12"
|
| 3 |
+
# dependencies = [
|
| 4 |
+
# "datasets>=3.0.0",
|
| 5 |
+
# "dynaword",
|
| 6 |
+
# "pydantic>=2.10.4",
|
| 7 |
+
# "transformers>=4.47.1",
|
| 8 |
+
# ]
|
| 9 |
+
#
|
| 10 |
+
# [tool.uv.sources]
|
| 11 |
+
# dynaword = { path = "../.." }
|
| 12 |
+
# ///
|
| 13 |
+
|
| 14 |
+
"""Download and process Språkbanken Text's `flashback-samhalle` corpus."""
|
| 15 |
+
|
| 16 |
+
import bz2
|
| 17 |
+
import logging
|
| 18 |
+
import urllib.request
|
| 19 |
+
import xml.etree.ElementTree as ET
|
| 20 |
+
from datetime import date
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
|
| 23 |
+
import datasets
|
| 24 |
+
from datasets import Dataset
|
| 25 |
+
from dynaword.process_dataset import (
|
| 26 |
+
add_token_count,
|
| 27 |
+
ensure_column_order,
|
| 28 |
+
remove_duplicate_text,
|
| 29 |
+
remove_empty_texts,
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
logger = logging.getLogger(__name__)
|
| 33 |
+
|
| 34 |
+
SOURCE = "flashback-samhalle"
|
| 35 |
+
XML_URL = "https://spraakbanken.gu.se/resurser/meningsmangder/flashback-samhalle.xml.bz2"
|
| 36 |
+
CACHE_FILE = Path(__file__).parent / "cache" / "flashback-samhalle.xml.bz2"
|
| 37 |
+
|
| 38 |
+
NO_SPACE_BEFORE = (".", ",", ";", ":", "!", "?", ")", "]", "}", "»")
|
| 39 |
+
NO_SPACE_AFTER = ("(", "[", "{", "«")
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def download_if_needed(url: str, path: Path) -> None:
|
| 43 |
+
if path.exists():
|
| 44 |
+
logger.info("Using cached %s", path)
|
| 45 |
+
return
|
| 46 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 47 |
+
logger.info("Downloading %s to %s", url, path)
|
| 48 |
+
urllib.request.urlretrieve(url, path)
|
| 49 |
+
logger.info("Download complete")
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def format_date(value: str) -> str:
|
| 53 |
+
return f"{value[:4]}-{value[4:6]}-{value[6:8]}"
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def detokenize(tokens: list[str]) -> str:
|
| 57 |
+
text = " ".join(t.strip() for t in tokens if t and t.strip())
|
| 58 |
+
for token in NO_SPACE_BEFORE:
|
| 59 |
+
text = text.replace(f" {token}", token)
|
| 60 |
+
for token in NO_SPACE_AFTER:
|
| 61 |
+
text = text.replace(f"{token} ", token)
|
| 62 |
+
return " ".join(text.split()).strip()
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def sentence_text(sentence: ET.Element) -> str:
|
| 66 |
+
tokens = [(t.text or "") for t in sentence.iter("token")]
|
| 67 |
+
return detokenize(tokens)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def iter_sentences(bz2_path: Path):
|
| 71 |
+
current_created = ""
|
| 72 |
+
index = 0
|
| 73 |
+
today = date.today().strftime("%Y-%m-%d")
|
| 74 |
+
with bz2.open(bz2_path, "rb") as f:
|
| 75 |
+
parent_stack: list[ET.Element] = []
|
| 76 |
+
for event, elem in ET.iterparse(f, events=("start", "end")):
|
| 77 |
+
if event == "start":
|
| 78 |
+
parent_stack.append(elem)
|
| 79 |
+
if elem.tag == "text":
|
| 80 |
+
datefrom = elem.attrib.get("datefrom", "")
|
| 81 |
+
dateto = elem.attrib.get("dateto", "")
|
| 82 |
+
current_created = (
|
| 83 |
+
f"{format_date(datefrom)}, {format_date(dateto)}"
|
| 84 |
+
if datefrom and dateto
|
| 85 |
+
else ""
|
| 86 |
+
)
|
| 87 |
+
else:
|
| 88 |
+
if elem.tag == "sentence":
|
| 89 |
+
text = sentence_text(elem)
|
| 90 |
+
if text:
|
| 91 |
+
index += 1
|
| 92 |
+
yield {
|
| 93 |
+
"id": f"{SOURCE}_{index:08d}",
|
| 94 |
+
"text": text,
|
| 95 |
+
"source": SOURCE,
|
| 96 |
+
"added": today,
|
| 97 |
+
"created": current_created,
|
| 98 |
+
}
|
| 99 |
+
if len(parent_stack) >= 2:
|
| 100 |
+
parent_stack[-2].remove(elem)
|
| 101 |
+
elem.clear()
|
| 102 |
+
elif elem.tag in ("text", "paragraph"):
|
| 103 |
+
if len(parent_stack) >= 2:
|
| 104 |
+
parent_stack[-2].remove(elem)
|
| 105 |
+
elem.clear()
|
| 106 |
+
parent_stack.pop()
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def build_dataset(bz2_path: Path) -> Dataset:
|
| 110 |
+
datasets.disable_caching()
|
| 111 |
+
dataset = Dataset.from_generator(lambda: iter_sentences(bz2_path))
|
| 112 |
+
dataset = remove_empty_texts(dataset)
|
| 113 |
+
dataset = remove_duplicate_text(dataset)
|
| 114 |
+
dataset = add_token_count(dataset)
|
| 115 |
+
dataset = ensure_column_order(dataset)
|
| 116 |
+
return dataset
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def main() -> None:
|
| 120 |
+
download_if_needed(XML_URL, CACHE_FILE)
|
| 121 |
+
dataset = build_dataset(CACHE_FILE)
|
| 122 |
+
output_path = Path(__file__).parent / f"{SOURCE}.parquet"
|
| 123 |
+
logger.info("Writing %s rows to %s", len(dataset), output_path)
|
| 124 |
+
dataset.to_parquet(output_path)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
log_path = Path(__file__).parent / f"{SOURCE}.log"
|
| 129 |
+
logging.basicConfig(
|
| 130 |
+
level=logging.INFO,
|
| 131 |
+
format="%(asctime)s - %(levelname)s - %(message)s",
|
| 132 |
+
handlers=[logging.StreamHandler(), logging.FileHandler(log_path)],
|
| 133 |
+
)
|
| 134 |
+
main()
|
data/flashback-samhalle/descriptive_stats.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"number_of_samples": 49485677,
|
| 3 |
+
"number_of_tokens": 1446029177,
|
| 4 |
+
"min_length_tokens": 2,
|
| 5 |
+
"max_length_tokens": 4500,
|
| 6 |
+
"number_of_characters": 4244469864,
|
| 7 |
+
"min_length_characters": 1,
|
| 8 |
+
"max_length_characters": 13920
|
| 9 |
+
}
|
data/flashback-samhalle/flashback-samhalle.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: 'Flashback: Society'
|
| 3 |
+
language:
|
| 4 |
+
- sv
|
| 5 |
+
license: cc-by-4.0
|
| 6 |
+
license_name: CC-BY 4.0
|
| 7 |
+
size_categories:
|
| 8 |
+
- 10M<n<100M
|
| 9 |
+
task_categories:
|
| 10 |
+
- text-generation
|
| 11 |
+
- fill-mask
|
| 12 |
+
task_ids:
|
| 13 |
+
- language-modeling
|
| 14 |
+
source_datasets:
|
| 15 |
+
- original
|
| 16 |
+
domains:
|
| 17 |
+
- Social Media
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# Dataset Card for Flashback: Society
|
| 21 |
+
|
| 22 |
+
<!-- START-SHORT DESCRIPTION -->
|
| 23 |
+
Sentences from the Society subforum of [Flashback](https://www.flashback.org), a large Swedish internet forum.
|
| 24 |
+
<!-- END-SHORT DESCRIPTION -->
|
| 25 |
+
|
| 26 |
+
This subset contains sentences from the Society subforum of Flashback, one of Sweden's largest internet forums. Each sample corresponds to a single sentence — the source corpus supplies sentences in scrambled order for copyright and privacy reasons, so the original post context is not recoverable.
|
| 27 |
+
|
| 28 |
+
## Dataset Description
|
| 29 |
+
|
| 30 |
+
<!-- START-DESC-STATS -->
|
| 31 |
+
- **Number of samples**: 49.49M
|
| 32 |
+
- **Number of tokens (Llama 3)**: 1.45B
|
| 33 |
+
- **Average document length in tokens (min, max)**: 29.22 (2, 4.50K)
|
| 34 |
+
<!-- END-DESC-STATS -->
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
## Dataset Structure
|
| 38 |
+
An example from the dataset looks as follows.
|
| 39 |
+
|
| 40 |
+
<!-- START-SAMPLE -->
|
| 41 |
+
```py
|
| 42 |
+
{
|
| 43 |
+
"id": "flashback-samhalle_00000001",
|
| 44 |
+
"text": "och högskoleutbildning.",
|
| 45 |
+
"source": "flashback-samhalle",
|
| 46 |
+
"added": "2026-05-30",
|
| 47 |
+
"created": "2007-10-01, 2007-10-01",
|
| 48 |
+
"token_count": 10
|
| 49 |
+
}
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
### Data Fields
|
| 53 |
+
|
| 54 |
+
An entry in the dataset consists of the following fields:
|
| 55 |
+
|
| 56 |
+
- `id` (`str`): A unique identifier for each document.
|
| 57 |
+
- `text` (`str`): The content of the document.
|
| 58 |
+
- `source` (`str`): The source of the document (see [Source Data](#source-data)).
|
| 59 |
+
- `added` (`str`): The date when the document was added to this collection.
|
| 60 |
+
- `created` (`str`): The date range when the document was originally created.
|
| 61 |
+
- `token_count` (`int`): The number of tokens in the sample computed using the Llama 3 tokenizer.
|
| 62 |
+
<!-- END-SAMPLE -->
|
| 63 |
+
|
| 64 |
+
### Dataset Statistics
|
| 65 |
+
|
| 66 |
+
<!-- START-DATASET PLOTS -->
|
| 67 |
+
<p align="center">
|
| 68 |
+
<img src="./images/dist_document_length.png" width="600" style="margin-right: 10px;" />
|
| 69 |
+
</p>
|
| 70 |
+
<!-- END-DATASET PLOTS -->
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
## Additional Information
|
| 74 |
+
|
| 75 |
+
### Limitations
|
| 76 |
+
|
| 77 |
+
Each sample is a single sentence. The source corpus deliberately scrambles sentence order for copyright and privacy protection, so the original post context is not recoverable.
|
| 78 |
+
|
| 79 |
+
The source material is tokenized and does not preserve the original spacing between tokens. We approximate readable spacing when reconstructing plain text.
|
| 80 |
+
|
| 81 |
+
As a forum corpus, this material contains informal, colloquial, and potentially offensive language.
|
| 82 |
+
|
| 83 |
+
### Source
|
| 84 |
+
|
| 85 |
+
We download the corpus from Språkbanken Text's official source file for *Flashback: Society*.
|
| 86 |
+
|
| 87 |
+
### Citation Information
|
| 88 |
+
|
| 89 |
+
If you use this subset, cite the original source release:
|
| 90 |
+
|
| 91 |
+
> Språkbanken Text (2025). Flashback: Society (updated: 2025-04-01). [Data set]. Språkbanken Text.
|
| 92 |
+
|
| 93 |
+
## License Information
|
| 94 |
+
|
| 95 |
+
The source corpus is distributed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
data/flashback-samhalle/flashback-samhalle.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c59e2f5f05482ec5bfeb182ba22f5aeb7289190a01bb866af3b8ce99e48ca742
|
| 3 |
+
size 3424365069
|
data/flashback-samhalle/images/dist_document_length.png
ADDED
|
Git LFS Details
|
data/flashback-sport/create.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /// script
|
| 2 |
+
# requires-python = ">=3.12"
|
| 3 |
+
# dependencies = [
|
| 4 |
+
# "datasets>=3.0.0",
|
| 5 |
+
# "dynaword",
|
| 6 |
+
# "pydantic>=2.10.4",
|
| 7 |
+
# "transformers>=4.47.1",
|
| 8 |
+
# ]
|
| 9 |
+
#
|
| 10 |
+
# [tool.uv.sources]
|
| 11 |
+
# dynaword = { path = "../.." }
|
| 12 |
+
# ///
|
| 13 |
+
|
| 14 |
+
"""Download and process Språkbanken Text's `flashback-sport` corpus."""
|
| 15 |
+
|
| 16 |
+
import bz2
|
| 17 |
+
import logging
|
| 18 |
+
import urllib.request
|
| 19 |
+
import xml.etree.ElementTree as ET
|
| 20 |
+
from datetime import date
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
|
| 23 |
+
import datasets
|
| 24 |
+
from datasets import Dataset
|
| 25 |
+
from dynaword.process_dataset import (
|
| 26 |
+
add_token_count,
|
| 27 |
+
ensure_column_order,
|
| 28 |
+
remove_duplicate_text,
|
| 29 |
+
remove_empty_texts,
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
logger = logging.getLogger(__name__)
|
| 33 |
+
|
| 34 |
+
SOURCE = "flashback-sport"
|
| 35 |
+
XML_URL = "https://spraakbanken.gu.se/resurser/meningsmangder/flashback-sport.xml.bz2"
|
| 36 |
+
CACHE_FILE = Path(__file__).parent / "cache" / "flashback-sport.xml.bz2"
|
| 37 |
+
|
| 38 |
+
NO_SPACE_BEFORE = (".", ",", ";", ":", "!", "?", ")", "]", "}", "»")
|
| 39 |
+
NO_SPACE_AFTER = ("(", "[", "{", "«")
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def download_if_needed(url: str, path: Path) -> None:
|
| 43 |
+
if path.exists():
|
| 44 |
+
logger.info("Using cached %s", path)
|
| 45 |
+
return
|
| 46 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 47 |
+
logger.info("Downloading %s to %s", url, path)
|
| 48 |
+
urllib.request.urlretrieve(url, path)
|
| 49 |
+
logger.info("Download complete")
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def format_date(value: str) -> str:
|
| 53 |
+
return f"{value[:4]}-{value[4:6]}-{value[6:8]}"
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def detokenize(tokens: list[str]) -> str:
|
| 57 |
+
text = " ".join(t.strip() for t in tokens if t and t.strip())
|
| 58 |
+
for token in NO_SPACE_BEFORE:
|
| 59 |
+
text = text.replace(f" {token}", token)
|
| 60 |
+
for token in NO_SPACE_AFTER:
|
| 61 |
+
text = text.replace(f"{token} ", token)
|
| 62 |
+
return " ".join(text.split()).strip()
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def sentence_text(sentence: ET.Element) -> str:
|
| 66 |
+
tokens = [(t.text or "") for t in sentence.iter("token")]
|
| 67 |
+
return detokenize(tokens)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def iter_sentences(bz2_path: Path):
|
| 71 |
+
current_created = ""
|
| 72 |
+
index = 0
|
| 73 |
+
today = date.today().strftime("%Y-%m-%d")
|
| 74 |
+
with bz2.open(bz2_path, "rb") as f:
|
| 75 |
+
parent_stack: list[ET.Element] = []
|
| 76 |
+
for event, elem in ET.iterparse(f, events=("start", "end")):
|
| 77 |
+
if event == "start":
|
| 78 |
+
parent_stack.append(elem)
|
| 79 |
+
if elem.tag == "text":
|
| 80 |
+
datefrom = elem.attrib.get("datefrom", "")
|
| 81 |
+
dateto = elem.attrib.get("dateto", "")
|
| 82 |
+
current_created = (
|
| 83 |
+
f"{format_date(datefrom)}, {format_date(dateto)}"
|
| 84 |
+
if datefrom and dateto
|
| 85 |
+
else ""
|
| 86 |
+
)
|
| 87 |
+
else:
|
| 88 |
+
if elem.tag == "sentence":
|
| 89 |
+
text = sentence_text(elem)
|
| 90 |
+
if text:
|
| 91 |
+
index += 1
|
| 92 |
+
yield {
|
| 93 |
+
"id": f"{SOURCE}_{index:08d}",
|
| 94 |
+
"text": text,
|
| 95 |
+
"source": SOURCE,
|
| 96 |
+
"added": today,
|
| 97 |
+
"created": current_created,
|
| 98 |
+
}
|
| 99 |
+
if len(parent_stack) >= 2:
|
| 100 |
+
parent_stack[-2].remove(elem)
|
| 101 |
+
elem.clear()
|
| 102 |
+
elif elem.tag in ("text", "paragraph"):
|
| 103 |
+
if len(parent_stack) >= 2:
|
| 104 |
+
parent_stack[-2].remove(elem)
|
| 105 |
+
elem.clear()
|
| 106 |
+
parent_stack.pop()
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def build_dataset(bz2_path: Path) -> Dataset:
|
| 110 |
+
datasets.disable_caching()
|
| 111 |
+
dataset = Dataset.from_generator(lambda: iter_sentences(bz2_path))
|
| 112 |
+
dataset = remove_empty_texts(dataset)
|
| 113 |
+
dataset = remove_duplicate_text(dataset)
|
| 114 |
+
dataset = add_token_count(dataset)
|
| 115 |
+
dataset = ensure_column_order(dataset)
|
| 116 |
+
return dataset
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def main() -> None:
|
| 120 |
+
download_if_needed(XML_URL, CACHE_FILE)
|
| 121 |
+
dataset = build_dataset(CACHE_FILE)
|
| 122 |
+
output_path = Path(__file__).parent / f"{SOURCE}.parquet"
|
| 123 |
+
logger.info("Writing %s rows to %s", len(dataset), output_path)
|
| 124 |
+
dataset.to_parquet(output_path)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
log_path = Path(__file__).parent / f"{SOURCE}.log"
|
| 129 |
+
logging.basicConfig(
|
| 130 |
+
level=logging.INFO,
|
| 131 |
+
format="%(asctime)s - %(levelname)s - %(message)s",
|
| 132 |
+
handlers=[logging.StreamHandler(), logging.FileHandler(log_path)],
|
| 133 |
+
)
|
| 134 |
+
main()
|
data/flashback-sport/descriptive_stats.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"number_of_samples": 18148623,
|
| 3 |
+
"number_of_tokens": 470500306,
|
| 4 |
+
"min_length_tokens": 2,
|
| 5 |
+
"max_length_tokens": 10365,
|
| 6 |
+
"number_of_characters": 1346398365,
|
| 7 |
+
"min_length_characters": 1,
|
| 8 |
+
"max_length_characters": 20327
|
| 9 |
+
}
|