Datasets:
Tasks:
Text Generation
Modalities:
Text
Formats:
parquet
Sub-tasks:
language-modeling
Languages:
Danish
Size:
100K - 1M
License:
KennethEnevoldsen
commited on
Merge branch 'pr/15' into desc_stats
Browse files- README.md +4 -0
- data/nordjyllandnews/create.py +22 -11
- data/nordjyllandnews/nordjyllandnews.parquet +2 -2
- pyproject.toml +2 -2
- scripts/bump_version.py +6 -6
- uv.lock +6 -6
README.md
CHANGED
@@ -81,6 +81,10 @@ configs:
|
|
81 |
data_files:
|
82 |
- split: train
|
83 |
path: data/wiki/*.parquet
|
|
|
|
|
|
|
|
|
84 |
- config_name: relig
|
85 |
data_files:
|
86 |
- split: train
|
|
|
81 |
data_files:
|
82 |
- split: train
|
83 |
path: data/wiki/*.parquet
|
84 |
+
- config_name: nordjyllandnews
|
85 |
+
data_files:
|
86 |
+
- split: train
|
87 |
+
path: data/nordjyllandnews/*.parquet
|
88 |
- config_name: relig
|
89 |
data_files:
|
90 |
- split: train
|
data/nordjyllandnews/create.py
CHANGED
@@ -4,11 +4,9 @@ This scripts download nordjylland news and converts it to the format of danish d
|
|
4 |
|
5 |
import random
|
6 |
from pathlib import Path
|
|
|
7 |
|
8 |
-
from datasets import load_dataset
|
9 |
-
|
10 |
-
source = "nordjyllandnews"
|
11 |
-
ds = load_dataset("alexandrainst/nordjylland-news-summarization", split="train")
|
12 |
|
13 |
schemas = [
|
14 |
"{summary}\n\n{text}",
|
@@ -16,25 +14,38 @@ schemas = [
|
|
16 |
"{text}\n\nReferat:\n{summary}",
|
17 |
"Lav et referat af nedenstående tekst:\n\nTekst:\n{text}\n\nReferat:\n{summary}",
|
18 |
]
|
|
|
19 |
|
20 |
|
21 |
def convert_sample(example):
|
22 |
-
schema = random.
|
23 |
-
|
24 |
new_example = dict(
|
25 |
-
|
26 |
source=source,
|
27 |
domain="News",
|
28 |
license="Creative Commons Legal Code\n\nCC0 1.0 Universal",
|
29 |
added="2024-12-16",
|
30 |
created="2000-01-01, 2024-01-01", # best guess
|
31 |
-
metadata=
|
32 |
)
|
33 |
|
34 |
return new_example
|
35 |
|
36 |
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
-
|
40 |
-
|
|
|
4 |
|
5 |
import random
|
6 |
from pathlib import Path
|
7 |
+
from typing import cast
|
8 |
|
9 |
+
from datasets import Dataset, load_dataset
|
|
|
|
|
|
|
10 |
|
11 |
schemas = [
|
12 |
"{summary}\n\n{text}",
|
|
|
14 |
"{text}\n\nReferat:\n{summary}",
|
15 |
"Lav et referat af nedenstående tekst:\n\nTekst:\n{text}\n\nReferat:\n{summary}",
|
16 |
]
|
17 |
+
source = "nordjyllandnews"
|
18 |
|
19 |
|
20 |
def convert_sample(example):
|
21 |
+
schema = random.choice(schemas)
|
|
|
22 |
new_example = dict(
|
23 |
+
text_new=schema.format(text=example["text"], summary=example["summary"]),
|
24 |
source=source,
|
25 |
domain="News",
|
26 |
license="Creative Commons Legal Code\n\nCC0 1.0 Universal",
|
27 |
added="2024-12-16",
|
28 |
created="2000-01-01, 2024-01-01", # best guess
|
29 |
+
metadata={"source-pretty": "Nordjylland News"},
|
30 |
)
|
31 |
|
32 |
return new_example
|
33 |
|
34 |
|
35 |
+
def main():
|
36 |
+
ds = load_dataset("alexandrainst/nordjylland-news-summarization", split="train")
|
37 |
+
ds = cast(Dataset, ds)
|
38 |
+
|
39 |
+
ds = ds.map(convert_sample, remove_columns=ds.column_names)
|
40 |
+
ds = ds.rename_columns({"text_new": "text"})
|
41 |
+
ds = ds.add_column("id", [f"{source}_{i}" for i in range(len(ds))]) # type: ignore
|
42 |
+
ds = ds.select_columns(
|
43 |
+
["text", "source", "id", "added", "created", "license", "domain", "metadata"]
|
44 |
+
)
|
45 |
+
|
46 |
+
save_path = Path(__file__).parent / f"{source}.parquet"
|
47 |
+
ds.to_parquet(save_path)
|
48 |
+
|
49 |
|
50 |
+
if __name__ == "__main__":
|
51 |
+
main()
|
data/nordjyllandnews/nordjyllandnews.parquet
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c434925b6234607b63c4e7ab6c9a1e1b75e49c7623e03dea3bdbc6ba579f7910
|
3 |
+
size 71191536
|
pyproject.toml
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
[project]
|
2 |
name = "danish-dynaword"
|
3 |
-
version = "1.0.
|
4 |
description = "project code for the danish dynaword project"
|
5 |
readme = "README.md"
|
6 |
requires-python = ">=3.13"
|
@@ -13,5 +13,5 @@ dependencies = [
|
|
13 |
"pytest>=8.3.4",
|
14 |
"ruff>=0.8.3",
|
15 |
"seaborn>=0.13.2",
|
16 |
-
"
|
17 |
]
|
|
|
1 |
[project]
|
2 |
name = "danish-dynaword"
|
3 |
+
version = "1.0.3"
|
4 |
description = "project code for the danish dynaword project"
|
5 |
readme = "README.md"
|
6 |
requires-python = ">=3.13"
|
|
|
13 |
"pytest>=8.3.4",
|
14 |
"ruff>=0.8.3",
|
15 |
"seaborn>=0.13.2",
|
16 |
+
"tomlkit>=0.13.2",
|
17 |
]
|
scripts/bump_version.py
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
-
from packaging.version import Version
|
2 |
from pathlib import Path
|
3 |
|
4 |
-
import
|
|
|
5 |
|
6 |
c_file = Path(__file__)
|
7 |
pyproject = c_file.parent.parent / "pyproject.toml"
|
8 |
|
9 |
|
10 |
with pyproject.open("r") as f:
|
11 |
-
data =
|
12 |
-
version = Version(data["project"]["version"])
|
13 |
-
data["project"]["version"] = str(
|
14 |
Version(f"{version.major}.{version.minor}.{version.micro + 1}")
|
15 |
)
|
16 |
|
17 |
with pyproject.open("w") as f:
|
18 |
-
|
|
|
|
|
1 |
from pathlib import Path
|
2 |
|
3 |
+
import tomlkit
|
4 |
+
from packaging.version import Version
|
5 |
|
6 |
c_file = Path(__file__)
|
7 |
pyproject = c_file.parent.parent / "pyproject.toml"
|
8 |
|
9 |
|
10 |
with pyproject.open("r") as f:
|
11 |
+
data = tomlkit.load(f)
|
12 |
+
version = Version(data["project"]["version"]) # type: ignore
|
13 |
+
data["project"]["version"] = str( # type: ignore
|
14 |
Version(f"{version.major}.{version.minor}.{version.micro + 1}")
|
15 |
)
|
16 |
|
17 |
with pyproject.open("w") as f:
|
18 |
+
tomlkit.dump(data, f)
|
uv.lock
CHANGED
@@ -210,7 +210,7 @@ dependencies = [
|
|
210 |
{ name = "pytest" },
|
211 |
{ name = "ruff" },
|
212 |
{ name = "seaborn" },
|
213 |
-
{ name = "
|
214 |
]
|
215 |
|
216 |
[package.metadata]
|
@@ -223,7 +223,7 @@ requires-dist = [
|
|
223 |
{ name = "pytest", specifier = ">=8.3.4" },
|
224 |
{ name = "ruff", specifier = ">=0.8.3" },
|
225 |
{ name = "seaborn", specifier = ">=0.13.2" },
|
226 |
-
{ name = "
|
227 |
]
|
228 |
|
229 |
[[package]]
|
@@ -1098,12 +1098,12 @@ wheels = [
|
|
1098 |
]
|
1099 |
|
1100 |
[[package]]
|
1101 |
-
name = "
|
1102 |
-
version = "0.
|
1103 |
source = { registry = "https://pypi.org/simple" }
|
1104 |
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
1105 |
wheels = [
|
1106 |
-
{ url = "https://files.pythonhosted.org/packages/
|
1107 |
]
|
1108 |
|
1109 |
[[package]]
|
|
|
210 |
{ name = "pytest" },
|
211 |
{ name = "ruff" },
|
212 |
{ name = "seaborn" },
|
213 |
+
{ name = "tomlkit" },
|
214 |
]
|
215 |
|
216 |
[package.metadata]
|
|
|
223 |
{ name = "pytest", specifier = ">=8.3.4" },
|
224 |
{ name = "ruff", specifier = ">=0.8.3" },
|
225 |
{ name = "seaborn", specifier = ">=0.13.2" },
|
226 |
+
{ name = "tomlkit", specifier = ">=0.13.2" },
|
227 |
]
|
228 |
|
229 |
[[package]]
|
|
|
1098 |
]
|
1099 |
|
1100 |
[[package]]
|
1101 |
+
name = "tomlkit"
|
1102 |
+
version = "0.13.2"
|
1103 |
source = { registry = "https://pypi.org/simple" }
|
1104 |
+
sdist = { url = "https://files.pythonhosted.org/packages/b1/09/a439bec5888f00a54b8b9f05fa94d7f901d6735ef4e55dcec9bc37b5d8fa/tomlkit-0.13.2.tar.gz", hash = "sha256:fff5fe59a87295b278abd31bec92c15d9bc4a06885ab12bcea52c71119392e79", size = 192885 }
|
1105 |
wheels = [
|
1106 |
+
{ url = "https://files.pythonhosted.org/packages/f9/b6/a447b5e4ec71e13871be01ba81f5dfc9d0af7e473da256ff46bc0e24026f/tomlkit-0.13.2-py3-none-any.whl", hash = "sha256:7a974427f6e119197f670fbbbeae7bef749a6c14e793db934baefc1b5f03efde", size = 37955 },
|
1107 |
]
|
1108 |
|
1109 |
[[package]]
|