tsv
Browse files- data/dev.tsv +0 -0
- data/test.tsv +0 -0
- data/train.tsv +0 -0
- norwegian_parliament.py +9 -9
data/dev.tsv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/test.tsv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/train.tsv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
norwegian_parliament.py
CHANGED
@@ -19,11 +19,11 @@ of the two major parties: Fremskrittspartiet and Sosialistisk Venstreparti.
|
|
19 |
|
20 |
_HOMEPAGE = "https://github.com/NBAiLab/notram/"
|
21 |
|
22 |
-
_BASE_URL = "https://
|
23 |
_URLS = {
|
24 |
-
"train": f"{_BASE_URL}train.
|
25 |
-
"dev": f"{_BASE_URL}dev.
|
26 |
-
"test": f"{_BASE_URL}test.
|
27 |
}
|
28 |
|
29 |
class NorwegianParliament(datasets.GeneratorBasedBuilder):
|
@@ -55,13 +55,13 @@ class NorwegianParliament(datasets.GeneratorBasedBuilder):
|
|
55 |
]
|
56 |
|
57 |
def _generate_examples(self, filepath):
|
58 |
-
with open(filepath, encoding="utf-8") as
|
59 |
-
|
60 |
-
next(
|
61 |
-
for idx, row in enumerate(
|
62 |
index, text, label, date = row
|
63 |
yield idx, {
|
64 |
-
"text": text
|
65 |
"label": label,
|
66 |
"date": date,
|
67 |
}
|
|
|
19 |
|
20 |
_HOMEPAGE = "https://github.com/NBAiLab/notram/"
|
21 |
|
22 |
+
_BASE_URL = "https://raw.githubusercontent.com/your-username/your-repo/main/data/"
|
23 |
_URLS = {
|
24 |
+
"train": f"{_BASE_URL}train.tsv",
|
25 |
+
"dev": f"{_BASE_URL}dev.tsv",
|
26 |
+
"test": f"{_BASE_URL}test.tsv",
|
27 |
}
|
28 |
|
29 |
class NorwegianParliament(datasets.GeneratorBasedBuilder):
|
|
|
55 |
]
|
56 |
|
57 |
def _generate_examples(self, filepath):
|
58 |
+
with open(filepath, encoding="utf-8") as file:
|
59 |
+
reader = csv.reader(file, delimiter="\t") # Use tab delimiter for TSV files
|
60 |
+
next(reader) # Skip the header
|
61 |
+
for idx, row in enumerate(reader):
|
62 |
index, text, label, date = row
|
63 |
yield idx, {
|
64 |
+
"text": text,
|
65 |
"label": label,
|
66 |
"date": date,
|
67 |
}
|