kris927b commited on
Commit
2c91001
·
verified ·
1 Parent(s): 16931a4

Fix Danske Taler (#69)

Browse files

- Updating the danske-taler dataset (861771ad5d976a24df77ba81642702a3c924e6c5)
- Running tests and bumping version (8d056aba9953ef0cf4c402ccb9deff745d8307af)
- Fixing error in create.py script. Did not handle case correctly. (3ffc702d8f3972eb9ae6e1f47ed2ddfb9f95324e)
- Using the dynaword package rather than custom functions. (ce4e62ce7e5c552450efd294057b046dcb2104ed)
- Fixing docstring (f54f99a733e32b1476b77fea48b458c41907a598)

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
  ## [v1.2.0] - 2025-06-23
9
 
10
  ### Fixed
 
5
 
6
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
7
 
8
+ ## [v1.2.1] - 2025-06-24
9
+
10
+ ### Fixed
11
+
12
+ - Updated the danske-taler dataset. This version fixes a problem where the texts from the API contains no newlines, and where there should have been newline there is now space between words and punctuation.
13
+
14
  ## [v1.2.0] - 2025-06-23
15
 
16
  ### Fixed
README.md CHANGED
@@ -174,7 +174,7 @@ https://github.com/huggingface/datasets/blob/main/templates/README_guide.md
174
  <!-- START README TABLE -->
175
  | | |
176
  | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
177
- | **Version** | 1.2.0 ([Changelog](/CHANGELOG.md)) |
178
  | **Language** | dan, dansk, Danish |
179
  | **License** | Openly Licensed, See the respective dataset |
180
  | **Models** | For model trained used this data see [danish-foundation-models](https://huggingface.co/danish-foundation-models) |
@@ -211,9 +211,9 @@ https://github.com/huggingface/datasets/blob/main/templates/README_guide.md
211
 
212
  <!-- START-DESC-STATS -->
213
  - **Language**: dan, dansk, Danish
214
- - **Number of samples**: 891.09K
215
  - **Number of tokens (Llama 3)**: 4.37B
216
- - **Average document length (characters)**: 15086.31
217
  <!-- END-DESC-STATS -->
218
 
219
 
@@ -333,7 +333,7 @@ Below follows a brief overview of the sources in the corpus along with their ind
333
  | [eur-lex-sum-da] | The Danish subsection of EUR-lex SUM consisting of EU legislation paired with professionally written summaries | Legal | 31.37M | [CC-BY-SA 4.0] |
334
  | [ncc_maalfrid] | Danish content from Norwegian institutions websites | Web | 29.26M | [NLOD 2.0] |
335
  | [tv2r] | Contemporary Danish newswire articles published between 2010 and 2019 | News | 21.67M | [CC-BY-SA 4.0] |
336
- | [danske-taler] | Danish Speeches from [dansketaler.dk](https://www.dansketaler.dk) | Conversation | 8.23M | [CC-0] |
337
  | [nota] | The text only part of the [Nota lyd- og tekstdata](https://sprogteknologi.dk/dataset/nota-lyd-og-tekstdata) dataset | Readaloud | 7.30M | [CC-0] |
338
  | [gutenberg] | The Danish subsection from Project [Gutenberg](https://www.gutenberg.org) | Books | 6.76M | [Gutenberg] |
339
  | [wikibooks] | The Danish Subsection of [Wikibooks](https://www.wikibooks.org) | Books | 6.24M | [CC-0] |
 
174
  <!-- START README TABLE -->
175
  | | |
176
  | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
177
+ | **Version** | 1.2.1 ([Changelog](/CHANGELOG.md)) |
178
  | **Language** | dan, dansk, Danish |
179
  | **License** | Openly Licensed, See the respective dataset |
180
  | **Models** | For model trained used this data see [danish-foundation-models](https://huggingface.co/danish-foundation-models) |
 
211
 
212
  <!-- START-DESC-STATS -->
213
  - **Language**: dan, dansk, Danish
214
+ - **Number of samples**: 891.35K
215
  - **Number of tokens (Llama 3)**: 4.37B
216
+ - **Average document length (characters)**: 15083.99
217
  <!-- END-DESC-STATS -->
218
 
219
 
 
333
  | [eur-lex-sum-da] | The Danish subsection of EUR-lex SUM consisting of EU legislation paired with professionally written summaries | Legal | 31.37M | [CC-BY-SA 4.0] |
334
  | [ncc_maalfrid] | Danish content from Norwegian institutions websites | Web | 29.26M | [NLOD 2.0] |
335
  | [tv2r] | Contemporary Danish newswire articles published between 2010 and 2019 | News | 21.67M | [CC-BY-SA 4.0] |
336
+ | [danske-taler] | Danish Speeches from [dansketaler.dk](https://www.dansketaler.dk) | Conversation | 8.81M | [CC-0] |
337
  | [nota] | The text only part of the [Nota lyd- og tekstdata](https://sprogteknologi.dk/dataset/nota-lyd-og-tekstdata) dataset | Readaloud | 7.30M | [CC-0] |
338
  | [gutenberg] | The Danish subsection from Project [Gutenberg](https://www.gutenberg.org) | Books | 6.76M | [Gutenberg] |
339
  | [wikibooks] | The Danish Subsection of [Wikibooks](https://www.wikibooks.org) | Books | 6.24M | [CC-0] |
data/danske-taler/create.py CHANGED
@@ -3,7 +3,11 @@
3
  # dependencies = [
4
  # "beautifulsoup4==4.13.3",
5
  # "datasets>=3.0.0",
 
 
6
  # ]
 
 
7
  # ///
8
  """
9
  Danske Taler API Downloader
@@ -26,6 +30,14 @@ It saves it into the following structure:
26
  }
27
  ```
28
 
 
 
 
 
 
 
 
 
29
  """
30
 
31
  import logging
@@ -34,21 +46,80 @@ from datetime import date
34
  from pathlib import Path
35
  from typing import Any
36
 
37
- import datasets
38
  import pandas as pd
39
  import requests
40
- from bs4 import BeautifulSoup
41
  from tqdm import tqdm
42
 
 
 
 
 
 
 
 
43
  logger = logging.getLogger(__name__)
44
 
45
  # Configuration
46
  API_BASE_URL = "https://www.dansketaler.dk/api/v1"
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  def get_all_speeches() -> list[dict[str, Any]]:
50
  # fetch first page, notably the total number of pages
51
- url = f"{API_BASE_URL}/speeches"
52
  response = requests.get(url)
53
  response.raise_for_status()
54
  speeches = response.json()
@@ -58,7 +129,7 @@ def get_all_speeches() -> list[dict[str, Any]]:
58
  # fetch all pages
59
  all_speeches = []
60
  for page in range(1, total_pages + 1):
61
- url = f"{API_BASE_URL}/speeches?page={page}"
62
  response = requests.get(url)
63
  response.raise_for_status()
64
  speeches = response.json()
@@ -67,9 +138,9 @@ def get_all_speeches() -> list[dict[str, Any]]:
67
  return all_speeches
68
 
69
 
70
- def fetch_license_div(
71
  url: str, max_retries: int = 3, backoff_factor: float = 0.5
72
- ) -> str | None:
73
  """
74
  Fetches the license div from the page with retry logic.
75
 
@@ -90,8 +161,29 @@ def fetch_license_div(
90
 
91
  soup = BeautifulSoup(response.text, "html.parser")
92
  license_div = soup.find("div", class_="speech-copyright")
93
-
94
- return license_div.text if license_div else None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
 
96
  except (requests.RequestException, AttributeError) as e:
97
  retries += 1
@@ -100,7 +192,7 @@ def fetch_license_div(
100
  logger.info(
101
  f"Failed to fetch license after {max_retries} attempts: {str(e)}"
102
  )
103
- return None
104
 
105
  # Calculate backoff time using exponential backoff
106
  wait_time = backoff_factor * (2 ** (retries - 1))
@@ -109,7 +201,7 @@ def fetch_license_div(
109
  )
110
  time.sleep(wait_time)
111
 
112
- return None
113
 
114
 
115
  def convert_to_license(license_information: str | None) -> str | None:
@@ -134,12 +226,12 @@ def convert_to_row(speech_meta: dict[str, Any]) -> dict[str, Any]:
134
  date_of_speech_start = f"{date_of_speech}"
135
  date_of_speech_end = f"{date_of_speech}"
136
 
137
- license_information = fetch_license_div(speech_meta["url"])
138
 
139
  row = {
140
- "text": speech_meta["transcription"],
141
- "source": "danske-taler",
142
  "id": f"danske-taler_{speech_id}",
 
 
143
  # current date
144
  "added": date.today().isoformat(),
145
  "created": f"{date_of_speech_start}, {date_of_speech_end}",
@@ -192,28 +284,19 @@ def main():
192
  df = df[df["license"] == "cc0"]
193
  logger.info(f"Removed {len_df - len(df)} documents without a cc0 license")
194
 
195
- # remove duplicate ids
196
- len_df = len(df)
197
- df = df.drop_duplicates(subset=["id"])
198
- logger.info(f"Removed {len_df - len(df)} duplicate ids")
199
 
200
- # remove rows with empty text
201
- len_df = len(df)
202
- df = df[df["text"].str.strip() != ""]
203
- logger.info(f"Removed {len_df - len(df)} rows with empty text")
204
-
205
- # remove rows with duplicate text
206
- len_df = len(df)
207
- df = df.drop_duplicates(subset=["text"])
208
- logger.info(f"Removed {len_df - len(df)} rows with duplicate text")
209
 
210
- dataset = datasets.Dataset.from_pandas(df)
211
  assert len(set(dataset["id"])) == len(dataset), "IDs are not unique"
212
  assert len(set(dataset["text"])) == len(dataset), "Texts are not unique"
213
- assert len(set(dataset["license"])) == 1, "Multiple licenses found"
214
 
215
  # check for html tags in text
216
- assert not df["text"].str.contains("<[^>]*>").any(), "HTML tags found in text"
217
 
218
  dataset.to_parquet(save_path)
219
 
 
3
  # dependencies = [
4
  # "beautifulsoup4==4.13.3",
5
  # "datasets>=3.0.0",
6
+ # "transformers",
7
+ # "dynaword"
8
  # ]
9
+ # [tool.uv.sources]
10
+ # dynaword = { git = "https://huggingface.co/datasets/danish-foundation-models/danish-dynaword", rev = "00e7f2aee7f7ad2da423419f77ecbb9c0536de0d" }
11
  # ///
12
  """
13
  Danske Taler API Downloader
 
30
  }
31
  ```
32
 
33
+ Note: To run this script, you need to set `GIT_LFS_SKIP_SMUDGE=1` to be able to install dynaword:
34
+
35
+ ```bash
36
+ GIT_LFS_SKIP_SMUDGE=1 uv run data/memo/create.py
37
+ ```
38
+
39
+ This second version fixed previous issues with the download and processing of the Danish Memo repository:
40
+ https://huggingface.co/datasets/danish-foundation-models/danish-dynaword/discussions/67
41
  """
42
 
43
  import logging
 
46
  from pathlib import Path
47
  from typing import Any
48
 
49
+ from datasets import Dataset
50
  import pandas as pd
51
  import requests
52
+ from bs4 import BeautifulSoup, NavigableString
53
  from tqdm import tqdm
54
 
55
+ from dynaword.process_dataset import (
56
+ add_token_count,
57
+ ensure_column_order,
58
+ remove_duplicate_text,
59
+ remove_empty_texts,
60
+ )
61
+
62
  logger = logging.getLogger(__name__)
63
 
64
  # Configuration
65
  API_BASE_URL = "https://www.dansketaler.dk/api/v1"
66
 
67
+ KNOWN_HTML_TAGS = {
68
+ "html",
69
+ "head",
70
+ "body",
71
+ "title",
72
+ "meta",
73
+ "link",
74
+ "script",
75
+ "style",
76
+ "div",
77
+ "span",
78
+ "p",
79
+ "a",
80
+ "ul",
81
+ "ol",
82
+ "li",
83
+ "table",
84
+ "tr",
85
+ "td",
86
+ "th",
87
+ "img",
88
+ "h1",
89
+ "h2",
90
+ "h3",
91
+ "h4",
92
+ "h5",
93
+ "h6",
94
+ "strong",
95
+ "em",
96
+ "br",
97
+ "hr",
98
+ "form",
99
+ "input",
100
+ "button",
101
+ "label",
102
+ "select",
103
+ "option",
104
+ "textarea",
105
+ "iframe",
106
+ "nav",
107
+ "footer",
108
+ "header",
109
+ "main",
110
+ "section",
111
+ "article",
112
+ }
113
+
114
+
115
+ def contains_html_tags(text):
116
+ soup = BeautifulSoup(str(text), "html.parser")
117
+ return any(tag.name in KNOWN_HTML_TAGS for tag in soup.find_all())
118
+
119
 
120
  def get_all_speeches() -> list[dict[str, Any]]:
121
  # fetch first page, notably the total number of pages
122
+ url = f"{API_BASE_URL}/speeches?per_page=50"
123
  response = requests.get(url)
124
  response.raise_for_status()
125
  speeches = response.json()
 
129
  # fetch all pages
130
  all_speeches = []
131
  for page in range(1, total_pages + 1):
132
+ url = f"{API_BASE_URL}/speeches?per_page=50&page={page}"
133
  response = requests.get(url)
134
  response.raise_for_status()
135
  speeches = response.json()
 
138
  return all_speeches
139
 
140
 
141
+ def fetch_speech_content(
142
  url: str, max_retries: int = 3, backoff_factor: float = 0.5
143
+ ) -> tuple[str | None, str]:
144
  """
145
  Fetches the license div from the page with retry logic.
146
 
 
161
 
162
  soup = BeautifulSoup(response.text, "html.parser")
163
  license_div = soup.find("div", class_="speech-copyright")
164
+ speech_div = soup.find("div", class_="speech-article-content")
165
+ speech = ""
166
+ if speech_div:
167
+ # Iterate over the children of the found div
168
+ for child_div in speech_div.children: # type: ignore
169
+ if child_div.name == "div": # type: ignore
170
+ current_paragraph = []
171
+ for content in child_div.contents: # type: ignore
172
+ if isinstance(content, NavigableString):
173
+ # Append text content
174
+ current_paragraph.append(str(content).strip())
175
+ elif content.name == "br":
176
+ # If a <br> is encountered, join and print the current paragraph, then reset
177
+ if current_paragraph:
178
+ speech += "".join(current_paragraph)
179
+ speech += "\n" # Add a newline for paragraph break
180
+ current_paragraph = []
181
+ # Print any remaining text in the current_paragraph list
182
+ if current_paragraph:
183
+ speech += "".join(current_paragraph)
184
+ speech += "\n" # Add a newline for paragraph break
185
+
186
+ return (license_div.text if license_div else None, speech)
187
 
188
  except (requests.RequestException, AttributeError) as e:
189
  retries += 1
 
192
  logger.info(
193
  f"Failed to fetch license after {max_retries} attempts: {str(e)}"
194
  )
195
+ return (None, "")
196
 
197
  # Calculate backoff time using exponential backoff
198
  wait_time = backoff_factor * (2 ** (retries - 1))
 
201
  )
202
  time.sleep(wait_time)
203
 
204
+ return (None, "")
205
 
206
 
207
  def convert_to_license(license_information: str | None) -> str | None:
 
226
  date_of_speech_start = f"{date_of_speech}"
227
  date_of_speech_end = f"{date_of_speech}"
228
 
229
+ (license_information, speech) = fetch_speech_content(speech_meta["url"])
230
 
231
  row = {
 
 
232
  "id": f"danske-taler_{speech_id}",
233
+ "text": speech,
234
+ "source": "danske-taler",
235
  # current date
236
  "added": date.today().isoformat(),
237
  "created": f"{date_of_speech_start}, {date_of_speech_end}",
 
284
  df = df[df["license"] == "cc0"]
285
  logger.info(f"Removed {len_df - len(df)} documents without a cc0 license")
286
 
287
+ dataset = Dataset.from_pandas(df, preserve_index=False)
 
 
 
288
 
289
+ dataset = remove_empty_texts(dataset) # remove rows with empty text
290
+ dataset = remove_duplicate_text(dataset) # remove rows with duplicate text
291
+ dataset = add_token_count(dataset)
292
+ dataset = ensure_column_order(dataset)
 
 
 
 
 
293
 
 
294
  assert len(set(dataset["id"])) == len(dataset), "IDs are not unique"
295
  assert len(set(dataset["text"])) == len(dataset), "Texts are not unique"
296
+ assert len(set(df["license"])) == 1, "Multiple licenses found"
297
 
298
  # check for html tags in text
299
+ assert not df["text"].apply(contains_html_tags).any(), "HTML tags found in text"
300
 
301
  dataset.to_parquet(save_path)
302
 
data/danske-taler/danske-taler.log CHANGED
@@ -55,3 +55,113 @@ Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Erro
55
  2025-03-29 14:28:03,549 - INFO - Removed 2 rows with empty text
56
  2025-03-29 14:28:03,631 - INFO - Removed 2 rows with duplicate text
57
  Creating parquet from Arrow format: 100%|██████████████████████████████████████████████████| 3/3 [00:00<00:00, 11.33ba/s]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  2025-03-29 14:28:03,549 - INFO - Removed 2 rows with empty text
56
  2025-03-29 14:28:03,631 - INFO - Removed 2 rows with duplicate text
57
  Creating parquet from Arrow format: 100%|██████████████████████████████████████████████████| 3/3 [00:00<00:00, 11.33ba/s]
58
+ 2025-06-24 13:03:05,424 - INFO - Found 5103 speeches
59
+ 2025-06-24 13:04:19,375 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
60
+ 2025-06-24 13:04:29,734 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
61
+ 2025-06-24 13:04:30,613 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
62
+ 2025-06-24 13:04:31,856 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
63
+ 2025-06-24 13:04:34,098 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/niels-hoejlund-pedersens-translokationstale-2020
64
+ 2025-06-24 13:05:10,223 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
65
+ 2025-06-24 13:05:11,113 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
66
+ 2025-06-24 13:05:12,575 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
67
+ 2025-06-24 13:05:14,814 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/katrine-lykke-pedersens-tale-til-unge-om-haab-i-en-coronatid
68
+ 2025-06-24 13:05:15,208 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
69
+ 2025-06-24 13:05:15,922 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
70
+ 2025-06-24 13:05:17,117 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
71
+ 2025-06-24 13:05:19,583 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/anastacia-halkens-tale-til-unge-om-haab-i-en-coronatid
72
+ 2025-06-24 13:05:20,875 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
73
+ 2025-06-24 13:05:21,619 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
74
+ 2025-06-24 13:05:22,844 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
75
+ 2025-06-24 13:05:25,074 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/thomas-vinterbergs-tale-ved-modtagelsen-af-oscar-prisen
76
+ 2025-06-24 13:06:01,599 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
77
+ 2025-06-24 13:06:02,313 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
78
+ 2025-06-24 13:06:03,588 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
79
+ 2025-06-24 13:06:05,817 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/pernille-vermunds-tale-ved-folketingets-aabningsdebat-2021
80
+ 2025-06-24 13:06:08,990 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
81
+ 2025-06-24 13:06:09,675 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
82
+ 2025-06-24 13:06:10,912 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
83
+ 2025-06-24 13:06:13,120 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/pernille-vermunds-tale-ved-nye-borgerliges-aarsmoede-2021
84
+ 2025-06-24 13:06:13,512 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
85
+ 2025-06-24 13:06:14,230 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
86
+ 2025-06-24 13:06:15,462 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
87
+ 2025-06-24 13:06:17,720 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/mette-thiesens-tale-ved-nye-borgerliges-aarsmoede-2021
88
+ 2025-06-24 13:06:17,920 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
89
+ 2025-06-24 13:06:18,656 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
90
+ 2025-06-24 13:06:19,902 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
91
+ 2025-06-24 13:06:22,132 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/peter-seier-christensens-tale-ved-nye-borgerliges-aarsmoede-2021
92
+ 2025-06-24 13:07:56,628 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
93
+ 2025-06-24 13:07:57,353 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
94
+ 2025-06-24 13:07:58,586 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
95
+ 2025-06-24 13:08:00,850 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/silke-ena-svares-tale-ved-demonstrationen-for-born-og-unge
96
+ 2025-06-24 13:19:38,142 - INFO - Saving 5103 speeches to dataset
97
+ 2025-06-24 13:19:38,322 - INFO - Unique licenses:
98
+ 2025-06-24 13:19:38,322 - INFO - None
99
+ 2025-06-24 13:19:38,322 - INFO - cc0
100
+ 2025-06-24 13:19:38,322 - INFO - Manuskript taget fra ft.dk. med tilladelse fra udgiver.
101
+ 2025-06-24 13:19:38,322 - INFO - Manuskript tilsendt af taler og udgivet af Danske Taler med tilladelse fra taler.
102
+ 2025-06-24 13:19:38,322 - INFO - Materialet er beskyttet af ophavsret, da talen ikke er holdt i offentligheden.
103
+ 2025-06-24 13:19:38,322 - INFO - Materialet er beskyttet af ophavsret
104
+ 2025-06-24 13:19:38,322 - INFO - Materialet er beskyttet af ophavsret
105
+ 2025-06-24 13:19:38,322 - INFO - Materialet et beskyttet af ophavsret
106
+ 2025-06-24 13:19:38,322 - INFO - Manuskript taget fra ft.dk med tilladelse fra udgiver.
107
+ 2025-06-24 13:19:38,322 - INFO - Materialet er beskyttet af ophavsret
108
+ 2025-06-24 13:19:38,322 - INFO - Materialet er omfattet af ophavsret
109
+ 2025-06-24 13:19:38,325 - INFO - Removed 2188 documents without a cc0 license
110
+ 2025-06-24 13:19:38,326 - INFO - Removed 0 duplicate ids
111
+ 2025-06-24 13:19:38,332 - INFO - Removed 1 rows with empty text
112
+ 2025-06-24 13:19:38,345 - INFO - Removed 2 rows with duplicate text2025-06-24 14:44:36,089 - INFO - Downloading speeches and saving to /Users/kristianjensen/Documents/danish-dynaword/data/danske-taler/tmp/danske-taler-all.parquet
113
+ 2025-06-24 14:44:36,089 - INFO - Fetching all speeches from Danske Taler API
114
+ 2025-06-24 14:45:43,887 - INFO - Found 5107 speeches
115
+ 2025-06-24 14:46:53,929 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
116
+ 2025-06-24 14:46:54,627 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
117
+ 2025-06-24 14:46:55,824 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
118
+ 2025-06-24 14:46:58,015 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/niels-hoejlund-pedersens-translokationstale-2020
119
+ 2025-06-24 14:47:34,505 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
120
+ 2025-06-24 14:47:35,215 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
121
+ 2025-06-24 14:47:36,514 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
122
+ 2025-06-24 14:47:38,725 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/katrine-lykke-pedersens-tale-til-unge-om-haab-i-en-coronatid
123
+ 2025-06-24 14:47:39,093 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
124
+ 2025-06-24 14:47:39,798 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
125
+ 2025-06-24 14:47:41,013 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
126
+ 2025-06-24 14:47:43,253 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/anastacia-halkens-tale-til-unge-om-haab-i-en-coronatid
127
+ 2025-06-24 14:47:44,528 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
128
+ 2025-06-24 14:47:45,272 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
129
+ 2025-06-24 14:47:46,492 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
130
+ 2025-06-24 14:47:48,691 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/thomas-vinterbergs-tale-ved-modtagelsen-af-oscar-prisen
131
+ 2025-06-24 14:48:26,340 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
132
+ 2025-06-24 14:48:27,037 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
133
+ 2025-06-24 14:48:28,248 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
134
+ 2025-06-24 14:48:30,496 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/pernille-vermunds-tale-ved-folketingets-aabningsdebat-2021
135
+ 2025-06-24 14:48:33,382 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
136
+ 2025-06-24 14:48:34,125 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
137
+ 2025-06-24 14:48:35,339 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
138
+ 2025-06-24 14:48:37,570 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/pernille-vermunds-tale-ved-nye-borgerliges-aarsmoede-2021
139
+ 2025-06-24 14:48:37,940 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
140
+ 2025-06-24 14:48:38,663 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
141
+ 2025-06-24 14:48:39,884 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
142
+ 2025-06-24 14:48:42,101 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/mette-thiesens-tale-ved-nye-borgerliges-aarsmoede-2021
143
+ 2025-06-24 14:48:42,357 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
144
+ 2025-06-24 14:48:43,097 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
145
+ 2025-06-24 14:48:44,340 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
146
+ 2025-06-24 14:48:46,560 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/peter-seier-christensens-tale-ved-nye-borgerliges-aarsmoede-2021
147
+ 2025-06-24 14:50:22,691 - INFO - Attempt 1 failed. Retrying in 0.50 seconds...
148
+ 2025-06-24 14:50:23,446 - INFO - Attempt 2 failed. Retrying in 1.00 seconds...
149
+ 2025-06-24 14:50:24,662 - INFO - Attempt 3 failed. Retrying in 2.00 seconds...
150
+ 2025-06-24 14:50:26,911 - INFO - Failed to fetch license after 3 attempts: 500 Server Error: Internal Server Error for url: https://www.dansketaler.dk/tale/silke-ena-svares-tale-ved-demonstrationen-for-born-og-unge
151
+ 2025-06-24 15:02:20,338 - INFO - Saving 5107 speeches to dataset
152
+ 2025-06-24 15:02:20,503 - INFO - Unique licenses:
153
+ 2025-06-24 15:02:20,503 - INFO - None
154
+ 2025-06-24 15:02:20,503 - INFO - cc0
155
+ 2025-06-24 15:02:20,503 - INFO - Materialet et beskyttet af ophavsret
156
+ 2025-06-24 15:02:20,503 - INFO - Materialet er beskyttet af ophavsret
157
+ 2025-06-24 15:02:20,503 - INFO - Materialet er omfattet af ophavsret
158
+ 2025-06-24 15:02:20,503 - INFO - Manuskript taget fra ft.dk. med tilladelse fra udgiver.
159
+ 2025-06-24 15:02:20,503 - INFO - Materialet er beskyttet af ophavsret
160
+ 2025-06-24 15:02:20,503 - INFO - Manuskript taget fra ft.dk med tilladelse fra udgiver.
161
+ 2025-06-24 15:02:20,503 - INFO - Materialet er beskyttet af ophavsret
162
+ 2025-06-24 15:02:20,503 - INFO - Materialet er beskyttet af ophavsret, da talen ikke er holdt i offentligheden.
163
+ 2025-06-24 15:02:20,503 - INFO - Manuskript tilsendt af taler og udgivet af Danske Taler med tilladelse fra taler.
164
+ 2025-06-24 15:02:20,506 - INFO - Removed 2191 documents without a cc0 license
165
+ 2025-06-24 15:02:20,508 - INFO - Removed 0 duplicate ids
166
+ 2025-06-24 15:02:20,516 - INFO - Removed 2 rows with empty text
167
+ 2025-06-24 15:02:20,529 - INFO - Removed 2 rows with duplicate text
data/danske-taler/danske-taler.md CHANGED
@@ -31,15 +31,17 @@ The goal of the dataset is to collect historical and timely speeches and make th
31
 
32
  Learn more about danske taler by reading their [about us](https://www.dansketaler.dk/om-os) page.
33
 
 
 
34
  ## Dataset Description
35
 
36
 
37
  <!-- START-DESC-STATS -->
38
  - **Language**: dan, dansk, Danish
39
  - **Domains**: Conversation, Speeches, Spoken
40
- - **Number of samples**: 2.66K
41
- - **Number of tokens (Llama 3)**: 8.23M
42
- - **Average document length (characters)**: 9446.26
43
  <!-- END-DESC-STATS -->
44
 
45
 
@@ -50,12 +52,12 @@ An example from the dataset looks as follows.
50
  <!-- START-SAMPLE -->
51
  ```py
52
  {
53
- "id": "danske-taler_278",
54
- "text": "Den 1. august i år var der forløbet 25 år siden den sidste verdenskrigs udbrud. En måned senere - de[...]",
55
  "source": "danske-taler",
56
- "added": "2025-03-29",
57
- "created": "1939-09-20, 1939-09-20",
58
- "token_count": 14115
59
  }
60
  ```
61
 
 
31
 
32
  Learn more about danske taler by reading their [about us](https://www.dansketaler.dk/om-os) page.
33
 
34
+ > NOTE: Danske-Taler is also collecting [sermons](https://www.dansketaler.dk/praedikener), but these are not included in this dataset.
35
+
36
  ## Dataset Description
37
 
38
 
39
  <!-- START-DESC-STATS -->
40
  - **Language**: dan, dansk, Danish
41
  - **Domains**: Conversation, Speeches, Spoken
42
+ - **Number of samples**: 2.91K
43
+ - **Number of tokens (Llama 3)**: 8.81M
44
+ - **Average document length (characters)**: 9228.65
45
  <!-- END-DESC-STATS -->
46
 
47
 
 
52
  <!-- START-SAMPLE -->
53
  ```py
54
  {
55
+ "id": "danske-taler_281",
56
+ "text": "Tyske landsmænd og -kvinder !\n\nSyv år er kort tid, en brøkdel af en enkel menneskelig normaltilværel[...]",
57
  "source": "danske-taler",
58
+ "added": "2025-06-24",
59
+ "created": "1940-01-30, 1940-01-30",
60
+ "token_count": 3020
61
  }
62
  ```
63
 
data/danske-taler/danske-taler.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:bcb369ce210815cdadad81f6cda59b5f06c6eedb6523a4851a2969999a6b1665
3
- size 15084153
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d007e606854f868febcf61a513302f7299ff35222fe9de487d17b9baaaedf248
3
+ size 16089529
data/danske-taler/descriptive_stats.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
- "number_of_samples": 2658,
3
- "average_document_length": 9446.262227238525,
4
- "number_of_tokens": 8227947,
5
- "revision": "d36009a401d1c1081fb7607d2d3159a20c4a356e"
6
  }
 
1
  {
2
+ "number_of_samples": 2912,
3
+ "average_document_length": 9228.645260989011,
4
+ "number_of_tokens": 8809004,
5
+ "revision": "8d056aba9953ef0cf4c402ccb9deff745d8307af"
6
  }
data/danske-taler/images/dist_document_length.png CHANGED

Git LFS Details

  • SHA256: 278ba9630d2da85b7227ce8fbeec88e577c20b886e8dabaca5a5b70b793b75b6
  • Pointer size: 131 Bytes
  • Size of remote file: 553 kB

Git LFS Details

  • SHA256: eea9882f1b9cc4bc36a728144f1e95c55337ac67b6c4f3c67a36d34ba0a8fd64
  • Pointer size: 131 Bytes
  • Size of remote file: 560 kB
descriptive_stats.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
- "number_of_samples": 891094,
3
- "average_document_length": 15086.31267857263,
4
- "number_of_tokens": 4369008328,
5
- "revision": "9e941ac4e56b7b77ec77b84a3a40130ba78a9511"
6
  }
 
1
  {
2
+ "number_of_samples": 891348,
3
+ "average_document_length": 15083.994534121353,
4
+ "number_of_tokens": 4369589385,
5
+ "revision": "8d056aba9953ef0cf4c402ccb9deff745d8307af"
6
  }
images/dist_document_length.png CHANGED

Git LFS Details

  • SHA256: 2dbdb1d263165561e626a37174aa91e94507d2679dc8e59bf4656b11666bb7df
  • Pointer size: 132 Bytes
  • Size of remote file: 1.88 MB

Git LFS Details

  • SHA256: a061e831f01059e36d3a75145e656ee33c8e9fb6cafaa94dacb057460f6936fd
  • Pointer size: 132 Bytes
  • Size of remote file: 1.89 MB
images/domain_distribution.png CHANGED

Git LFS Details

  • SHA256: 5e3bb3991b3ce3f55b60af0fc6bfde5a45017e453e2dd1bfb382711e44596ab1
  • Pointer size: 131 Bytes
  • Size of remote file: 331 kB

Git LFS Details

  • SHA256: f0d13382a5aeeb05a4ee15e59b0dd7e4c8f89a07d63bb639f759069325884923
  • Pointer size: 131 Bytes
  • Size of remote file: 338 kB
pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
  [project]
2
  name = "dynaword"
3
- version = "1.2.0"
4
  description = "project code for the danish dynaword project"
5
  readme = "README.md"
6
  requires-python = ">=3.12,<3.13" # 3.13 have issues with spacy and pytorch
 
1
  [project]
2
  name = "dynaword"
3
+ version = "1.2.1"
4
  description = "project code for the danish dynaword project"
5
  readme = "README.md"
6
  requires-python = ">=3.12,<3.13" # 3.13 have issues with spacy and pytorch
test_results.log CHANGED
@@ -1,8 +1,7 @@
1
  ============================= test session starts ==============================
2
- platform darwin -- Python 3.12.0, pytest-8.3.4, pluggy-1.5.0
3
- rootdir: /Users/au561649/Github/danish-dynaword
4
  configfile: pyproject.toml
5
- plugins: anyio-4.9.0
6
  collected 310 items
7
 
8
  src/tests/test_dataset_schema.py ....................................... [ 12%]
@@ -19,7 +18,7 @@ src/tests/test_unique_ids.py . [100%]
19
 
20
  =============================== warnings summary ===============================
21
  src/tests/test_quality/test_short_texts.py: 34 warnings
22
- /Users/au561649/Github/danish-dynaword/.venv/lib/python3.12/site-packages/datasets/utils/_dill.py:385: DeprecationWarning: co_lnotab is deprecated, use co_lines instead.
23
 
24
  -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
25
- ============ 309 passed, 1 skipped, 34 warnings in 77.84s (0:01:17) ============
 
1
  ============================= test session starts ==============================
2
+ platform darwin -- Python 3.12.9, pytest-8.3.4, pluggy-1.5.0
3
+ rootdir: /Users/kristianjensen/Documents/danish-dynaword
4
  configfile: pyproject.toml
 
5
  collected 310 items
6
 
7
  src/tests/test_dataset_schema.py ....................................... [ 12%]
 
18
 
19
  =============================== warnings summary ===============================
20
  src/tests/test_quality/test_short_texts.py: 34 warnings
21
+ /Users/kristianjensen/Documents/danish-dynaword/.venv/lib/python3.12/site-packages/datasets/utils/_dill.py:385: DeprecationWarning: co_lnotab is deprecated, use co_lines instead.
22
 
23
  -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
24
+ ================= 309 passed, 1 skipped, 34 warnings in 46.75s =================
uv.lock CHANGED
The diff for this file is too large to render. See raw diff