Datasets:
nkjp
/

Modalities:
Text
Formats:
parquet
Languages:
Polish
Libraries:
Datasets
pandas
License:
albertvillanova HF staff commited on
Commit
efacde1
1 Parent(s): 2276532

Delete loading script

Browse files
Files changed (1) hide show
  1. nkjp-ner.py +0 -107
nkjp-ner.py DELETED
@@ -1,107 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- """NKJP-NER"""
16
-
17
-
18
- import csv
19
- import os
20
-
21
- import datasets
22
- from datasets.tasks import TextClassification
23
-
24
-
25
- _CITATION = """\
26
- @book{przepiorkowski2012narodowy,
27
- title={Narodowy korpus jezyka polskiego},
28
- author={Przepi{\'o}rkowski, Adam},
29
- year={2012},
30
- publisher={Naukowe PWN}
31
- }
32
- """
33
-
34
- _DESCRIPTION = """\
35
- The NKJP-NER is based on a human-annotated part of National Corpus of Polish (NKJP). We extracted sentences with named entities of exactly one type. The task is to predict the type of the named entity.
36
- """
37
-
38
- _HOMEPAGE = "https://klejbenchmark.com/tasks/"
39
-
40
- _LICENSE = "GNU GPL v.3"
41
-
42
- _URLs = "https://klejbenchmark.com/static/data/klej_nkjp-ner.zip"
43
-
44
-
45
- class NkjpNer(datasets.GeneratorBasedBuilder):
46
- """NKJP-NER"""
47
-
48
- VERSION = datasets.Version("1.1.0")
49
-
50
- def _info(self):
51
- return datasets.DatasetInfo(
52
- description=_DESCRIPTION,
53
- features=datasets.Features(
54
- {
55
- "sentence": datasets.Value("string"),
56
- "target": datasets.ClassLabel(
57
- names=[
58
- "geogName",
59
- "noEntity",
60
- "orgName",
61
- "persName",
62
- "placeName",
63
- "time",
64
- ]
65
- ),
66
- }
67
- ),
68
- supervised_keys=None,
69
- homepage=_HOMEPAGE,
70
- license=_LICENSE,
71
- citation=_CITATION,
72
- task_templates=[TextClassification(text_column="sentence", label_column="target")],
73
- )
74
-
75
- def _split_generators(self, dl_manager):
76
- """Returns SplitGenerators."""
77
- data_dir = dl_manager.download_and_extract(_URLs)
78
- return [
79
- datasets.SplitGenerator(
80
- name=datasets.Split.TRAIN,
81
- gen_kwargs={
82
- "filepath": os.path.join(data_dir, "train.tsv"),
83
- "split": "train",
84
- },
85
- ),
86
- datasets.SplitGenerator(
87
- name=datasets.Split.TEST,
88
- gen_kwargs={"filepath": os.path.join(data_dir, "test_features.tsv"), "split": "test"},
89
- ),
90
- datasets.SplitGenerator(
91
- name=datasets.Split.VALIDATION,
92
- gen_kwargs={
93
- "filepath": os.path.join(data_dir, "dev.tsv"),
94
- "split": "dev",
95
- },
96
- ),
97
- ]
98
-
99
- def _generate_examples(self, filepath, split):
100
- """Yields examples."""
101
- with open(filepath, encoding="utf-8") as f:
102
- reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
103
- for id_, row in enumerate(reader):
104
- yield id_, {
105
- "sentence": row["sentence"],
106
- "target": -1 if split == "test" else row["target"],
107
- }