Datasets:

Languages:
Japanese
License:
singletongue commited on
Commit
9483cca
·
1 Parent(s): 7d2fa91

Add a dataset loading script

Browse files
Files changed (2) hide show
  1. README.md +34 -0
  2. jsnli.py +53 -0
README.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ja
4
+ size_categories:
5
+ - 100K<n<1M
6
+ license:
7
+ - cc-by-sa-4.0
8
+ dataset_info:
9
+ features:
10
+ - name: premise
11
+ dtype: string
12
+ - name: hypothesis
13
+ dtype: string
14
+ - name: label
15
+ dtype: string
16
+ splits:
17
+ - name: train
18
+ num_bytes: 97491392
19
+ num_examples: 533005
20
+ - name: validation
21
+ num_bytes: 712792
22
+ num_examples: 3916
23
+ download_size: 44931163
24
+ dataset_size: 98204184
25
+ ---
26
+
27
+ # Dataset Card for llm-book/jsnli
28
+
29
+ 書籍『大規模言語モデル入門』で使用する [JSNLI](https://nlp.ist.i.kyoto-u.ac.jp/?日本語SNLI(JSNLI)データセット) のデータセットです。
30
+ JSNLI Version 1.1 のデータセットのうち、フィルタリング後の訓練セット (train_w_filtering) と検証セット (dev) を使用しています。
31
+
32
+ ## Licence
33
+
34
+ CC BY-SA 4.0
jsnli.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ from typing import Any, Dict, Iterator, List, Tuple
3
+
4
+ import datasets
5
+
6
+
7
+ _DESCRIPTION = (
8
+ "書籍『大規模言語モデル入門』で使用する JSNLI のデータセットです。"
9
+ "JSNLI Version 1.1 のデータセットのうち、フィルタリング後の訓練セット (train_w_filtering) と検証セット (dev) を使用しています。"
10
+ )
11
+ _HOMEPAGE = "https://nlp.ist.i.kyoto-u.ac.jp/?日本語SNLI(JSNLI)データセット"
12
+ _LICENSE = "CC BY-SA 4.0"
13
+
14
+ _URL = "https://nlp.ist.i.kyoto-u.ac.jp/DLcounter/lime.cgi?down=https://nlp.ist.i.kyoto-u.ac.jp/nl-resource/JSNLI/jsnli_1.1.zip&name=JSNLI.zip"
15
+
16
+
17
+ class JSNLI(datasets.GeneratorBasedBuilder):
18
+ VERSION = datasets.Version("1.0.0")
19
+
20
+ def _info(self) -> datasets.DatasetInfo:
21
+ features = datasets.Features({
22
+ "premise": datasets.Value("string"),
23
+ "hypothesis": datasets.Value("string"),
24
+ "label": datasets.Value("string"),
25
+ })
26
+ return datasets.DatasetInfo(
27
+ description=_DESCRIPTION,
28
+ homepage=_HOMEPAGE,
29
+ license=_LICENSE,
30
+ features=features,
31
+ )
32
+
33
+ def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
34
+ base_filepath = dl_manager.download_and_extract(_URL)
35
+ train_filepath = Path(base_filepath) / "jsnli_1.1" / "train_w_filtering.tsv"
36
+ dev_filepath = Path(base_filepath) / "jsnli_1.1" / "dev.tsv"
37
+
38
+ split_generators = [
39
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_filepath}),
40
+ datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": dev_filepath}),
41
+ ]
42
+ return split_generators
43
+
44
+ def _generate_examples(self, filepath: str) -> Iterator[Tuple[int, Dict[str, Any]]]:
45
+ with open(filepath) as f:
46
+ for i, line in enumerate(f):
47
+ label, premise, hypothesis = line.rstrip("\n").split("\t")
48
+ example = {
49
+ "premise": premise,
50
+ "hypothesis": hypothesis,
51
+ "label": label,
52
+ }
53
+ yield i, example