Convert dataset to Parquet

#5
by HenriqueLz - opened
README.md CHANGED
@@ -20,6 +20,7 @@ task_ids:
20
  paperswithcode_id: lener-br
21
  pretty_name: leNER-br
22
  dataset_info:
 
23
  features:
24
  - name: id
25
  dtype: string
@@ -42,21 +43,30 @@ dataset_info:
42
  '10': I-LEGISLACAO
43
  '11': B-JURISPRUDENCIA
44
  '12': I-JURISPRUDENCIA
45
- config_name: lener_br
46
  splits:
47
  - name: train
48
- num_bytes: 3984189
49
  num_examples: 7828
50
  - name: validation
51
- num_bytes: 719433
52
  num_examples: 1177
53
  - name: test
54
- num_bytes: 823708
55
  num_examples: 1390
56
- download_size: 2983137
57
- dataset_size: 5527330
58
  tags:
59
  - legal
 
 
 
 
 
 
 
 
 
 
60
  ---
61
 
62
  # Dataset Card for leNER-br
 
20
  paperswithcode_id: lener-br
21
  pretty_name: leNER-br
22
  dataset_info:
23
+ config_name: lener_br
24
  features:
25
  - name: id
26
  dtype: string
 
43
  '10': I-LEGISLACAO
44
  '11': B-JURISPRUDENCIA
45
  '12': I-JURISPRUDENCIA
 
46
  splits:
47
  - name: train
48
+ num_bytes: 3984173
49
  num_examples: 7828
50
  - name: validation
51
+ num_bytes: 719417
52
  num_examples: 1177
53
  - name: test
54
+ num_bytes: 823692
55
  num_examples: 1390
56
+ download_size: 1033001
57
+ dataset_size: 5527282
58
  tags:
59
  - legal
60
+ configs:
61
+ - config_name: lener_br
62
+ data_files:
63
+ - split: train
64
+ path: lener_br/train-*
65
+ - split: validation
66
+ path: lener_br/validation-*
67
+ - split: test
68
+ path: lener_br/test-*
69
+ default: true
70
  ---
71
 
72
  # Dataset Card for leNER-br
lener_br.py DELETED
@@ -1,160 +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
- """LeNER-Br dataset"""
16
-
17
-
18
- import datasets
19
-
20
-
21
- logger = datasets.logging.get_logger(__name__)
22
-
23
-
24
- _CITATION = """
25
- @inproceedings{luz_etal_propor2018,
26
- author = {Pedro H. {Luz de Araujo} and Te\'{o}filo E. {de Campos} and
27
- Renato R. R. {de Oliveira} and Matheus Stauffer and
28
- Samuel Couto and Paulo Bermejo},
29
- title = {{LeNER-Br}: a Dataset for Named Entity Recognition in {Brazilian} Legal Text},
30
- booktitle = {International Conference on the Computational Processing of Portuguese ({PROPOR})},
31
- publisher = {Springer},
32
- series = {Lecture Notes on Computer Science ({LNCS})},
33
- pages = {313--323},
34
- year = {2018},
35
- month = {September 24-26},
36
- address = {Canela, RS, Brazil},
37
- doi = {10.1007/978-3-319-99722-3_32},
38
- url = {https://cic.unb.br/~teodecampos/LeNER-Br/},
39
- }
40
- """
41
-
42
- _DESCRIPTION = """
43
- LeNER-Br is a Portuguese language dataset for named entity recognition
44
- applied to legal documents. LeNER-Br consists entirely of manually annotated
45
- legislation and legal cases texts and contains tags for persons, locations,
46
- time entities, organizations, legislation and legal cases.
47
- To compose the dataset, 66 legal documents from several Brazilian Courts were
48
- collected. Courts of superior and state levels were considered, such as Supremo
49
- Tribunal Federal, Superior Tribunal de Justiça, Tribunal de Justiça de Minas
50
- Gerais and Tribunal de Contas da União. In addition, four legislation documents
51
- were collected, such as "Lei Maria da Penha", giving a total of 70 documents
52
- """
53
-
54
- _HOMEPAGE = "https://cic.unb.br/~teodecampos/LeNER-Br/"
55
-
56
- _URL = "https://github.com/peluz/lener-br/raw/master/leNER-Br/"
57
- _TRAINING_FILE = "train/train.conll"
58
- _DEV_FILE = "dev/dev.conll"
59
- _TEST_FILE = "test/test.conll"
60
-
61
-
62
- class LenerBr(datasets.GeneratorBasedBuilder):
63
- """LeNER-Br dataset"""
64
-
65
- VERSION = datasets.Version("1.0.0")
66
-
67
- BUILDER_CONFIGS = [
68
- datasets.BuilderConfig(name="lener_br", version=VERSION, description="LeNER-Br dataset"),
69
- ]
70
-
71
- def _info(self):
72
- return datasets.DatasetInfo(
73
- description=_DESCRIPTION,
74
- features=datasets.Features(
75
- {
76
- "id": datasets.Value("string"),
77
- "tokens": datasets.Sequence(datasets.Value("string")),
78
- "ner_tags": datasets.Sequence(
79
- datasets.features.ClassLabel(
80
- names=[
81
- "O",
82
- "B-ORGANIZACAO",
83
- "I-ORGANIZACAO",
84
- "B-PESSOA",
85
- "I-PESSOA",
86
- "B-TEMPO",
87
- "I-TEMPO",
88
- "B-LOCAL",
89
- "I-LOCAL",
90
- "B-LEGISLACAO",
91
- "I-LEGISLACAO",
92
- "B-JURISPRUDENCIA",
93
- "I-JURISPRUDENCIA",
94
- ]
95
- )
96
- ),
97
- }
98
- ),
99
- supervised_keys=None,
100
- homepage="https://cic.unb.br/~teodecampos/LeNER-Br/",
101
- citation=_CITATION,
102
- )
103
-
104
- def _split_generators(self, dl_manager):
105
- """Returns SplitGenerators."""
106
- urls_to_download = {
107
- "train": f"{_URL}{_TRAINING_FILE}",
108
- "dev": f"{_URL}{_DEV_FILE}",
109
- "test": f"{_URL}{_TEST_FILE}",
110
- }
111
- downloaded_files = dl_manager.download_and_extract(urls_to_download)
112
-
113
- return [
114
- datasets.SplitGenerator(
115
- name=datasets.Split.TRAIN,
116
- gen_kwargs={"filepath": downloaded_files["train"], "split": "train"},
117
- ),
118
- datasets.SplitGenerator(
119
- name=datasets.Split.VALIDATION,
120
- gen_kwargs={"filepath": downloaded_files["dev"], "split": "validation"},
121
- ),
122
- datasets.SplitGenerator(
123
- name=datasets.Split.TEST,
124
- gen_kwargs={"filepath": downloaded_files["test"], "split": "test"},
125
- ),
126
- ]
127
-
128
- def _generate_examples(self, filepath, split):
129
- """Yields examples."""
130
-
131
- logger.info("⏳ Generating examples from = %s", filepath)
132
-
133
- with open(filepath, encoding="utf-8") as f:
134
-
135
- guid = 0
136
- tokens = []
137
- ner_tags = []
138
-
139
- for line in f:
140
- if line == "" or line == "\n":
141
- if tokens:
142
- yield guid, {
143
- "id": str(guid),
144
- "tokens": tokens,
145
- "ner_tags": ner_tags,
146
- }
147
- guid += 1
148
- tokens = []
149
- ner_tags = []
150
- else:
151
- splits = line.split(" ")
152
- tokens.append(splits[0])
153
- ner_tags.append(splits[1].rstrip())
154
-
155
- # last example
156
- yield guid, {
157
- "id": str(guid),
158
- "tokens": tokens,
159
- "ner_tags": ner_tags,
160
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lener_br/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1a218d5c61dc9a6a7b5a63b8879d02ab1d1111a665929590b42f7529eefca7ac
3
+ size 161083
lener_br/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:de9d271e017c885714a846fbdc3a2166cda0c554d229c972701731d3d46b6ade
3
+ size 739992
lener_br/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fdb63faa5374cfbab821344623bd78050dc98faa2df8017f977aa032ada7d43f
3
+ size 131926