Datasets:

Languages:
Hebrew
Multilinguality:
monolingual
Size Categories:
n<1K
Language Creators:
crowdsourced
Annotations Creators:
no-annotation
Source Datasets:
original
Tags:
License:
File size: 2,340 Bytes
c59a4e1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import glob
import os
from functools import partial

import datasets

VERSION = datasets.Version("0.0.1")

SUBSET_NAMES = [
    "kneset16",
    "kneset17",
    "knesset_tagged",
]


class KnessetMeetingsCorpus(datasets.GeneratorBasedBuilder):
    """Knesset meetings corpus"""

    BUILDER_CONFIGS = [
        datasets.BuilderConfig(name=name, version=VERSION,
                               description=f"{name} meetings corpus")
        for name in SUBSET_NAMES
    ]

    def _info(self):
        return datasets.DatasetInfo(
            description="A corpus of transcriptions of Knesset (Israeli parliament) meetings between January 2004 and November 2005",
            features=datasets.Features(
                {
                    "path": datasets.Value("string"),
                    "text": datasets.Value("string"),
                }
            ),
            homepage="https://zenodo.org/record/2707356",
            citation="""TODO""",
        )

    def _split_generators(self, dl_manager):
        downloader = partial(
            lambda split: dl_manager.download_and_extract(
                f"data/{self.config.name}.tar.gz"),
        )

        return [
            datasets.SplitGenerator(
                name=datasets.Split.TRAIN,
                gen_kwargs={
                    "root_path": downloader("train"),
                    "split": "train",
                    "subset_name": self.config.name,
                },
            )
        ]

    def _generate_examples(self, root_path, split, subset_name):
        data_folder = os.path.join(root_path, subset_name)
        if subset_name == "knesset_tagged":
            for xml_file in glob.glob(f"{data_folder}/16/*.xml"):
                uid = os.path.splitext(os.path.basename(xml_file))[0]
                yield uid, {
                    "path": xml_file,
                    "text": None,
                }
        else:
            for txt_file in glob.glob(f"{data_folder}/txt/*.txt"):
                uid = os.path.splitext(os.path.basename(txt_file))[0]
                docx_file = os.path.join(data_folder, "docx", f"{uid}.docx")
                yield uid, {
                    "path": docx_file,
                    "text": open(txt_file, "r").read(),
                }