EBIQUITY V2 Stemmed dataset added
Browse files- .idea/.gitignore +3 -0
- README.md +28 -0
- ebiquity-v2-stemmed.py +105 -0
.idea/.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
# Default ignored files
|
2 |
+
/shelf/
|
3 |
+
/workspace.xml
|
README.md
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
dataset_info:
|
3 |
+
features:
|
4 |
+
- name: id
|
5 |
+
dtype: string
|
6 |
+
- name: tokens
|
7 |
+
sequence: string
|
8 |
+
- name: ner_tags
|
9 |
+
sequence:
|
10 |
+
class_label:
|
11 |
+
names:
|
12 |
+
'0': O
|
13 |
+
'1': B-PER
|
14 |
+
'2': I-PER
|
15 |
+
'3': B-ORG
|
16 |
+
'4': I-ORG
|
17 |
+
'5': B-LOC
|
18 |
+
'6': I-LOC
|
19 |
+
'7': B-MISC
|
20 |
+
'8': I-MISC
|
21 |
+
config_name: ebiquity-v2-stemmed
|
22 |
+
splits:
|
23 |
+
- name: train
|
24 |
+
num_bytes: 2192488
|
25 |
+
num_examples: 3289
|
26 |
+
download_size: 1414009
|
27 |
+
dataset_size: 2192488
|
28 |
+
---
|
ebiquity-v2-stemmed.py
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import re
|
2 |
+
|
3 |
+
import datasets
|
4 |
+
|
5 |
+
_CITATION = """
|
6 |
+
@INPROCEEDINGS{
|
7 |
+
8998477,
|
8 |
+
author={O. M. {Singh} and A. {Padia} and A. {Joshi}},
|
9 |
+
booktitle={2019 IEEE 5th International Conference on Collaboration and Internet Computing (CIC)},
|
10 |
+
title={Named Entity Recognition for Nepali Language},
|
11 |
+
year={2019},
|
12 |
+
volume={},
|
13 |
+
number={},
|
14 |
+
pages={184-190},
|
15 |
+
keywords={Named Entity Recognition;Nepali;Low-resource;BiLSTM;CNN;Grapheme},
|
16 |
+
doi={10.1109/CIC48465.2019.00031},
|
17 |
+
ISSN={null},
|
18 |
+
month={Dec},}
|
19 |
+
"""
|
20 |
+
|
21 |
+
_DESCRIPTION = """
|
22 |
+
Ebiquity V2 (stemmed) dataset for Nepali NER task. The dataset is tagged with BIO scheme.
|
23 |
+
"""
|
24 |
+
|
25 |
+
_URL = "https://raw.githubusercontent.com/mani-rai/nepali-ner/master/data/ebiquity_v2/stemmed/total.bio"
|
26 |
+
|
27 |
+
|
28 |
+
class EbiquityV2StemmedConfig(datasets.BuilderConfig):
|
29 |
+
"""BuilderConfig for Ebiquity V2 Stemmed"""
|
30 |
+
|
31 |
+
def __init__(self, **kwargs):
|
32 |
+
"""BuilderConfig for Ebiquity V2 Stemmed.
|
33 |
+
Args:
|
34 |
+
**kwargs: keyword arguments forwarded to super.
|
35 |
+
"""
|
36 |
+
super(EbiquityV2StemmedConfig, self).__init__(**kwargs)
|
37 |
+
|
38 |
+
|
39 |
+
class EbiquityV2Stemmed(datasets.GeneratorBasedBuilder):
|
40 |
+
"""Ebiquity V2 Stemmed"""
|
41 |
+
|
42 |
+
BUILDER_CONFIGS = [
|
43 |
+
EbiquityV2StemmedConfig(name="ebiquity-v2-stemmed", version=datasets.Version("1.0.0"), description="Ebiquity v2 stemmed dataset"),
|
44 |
+
]
|
45 |
+
|
46 |
+
def _info(self):
|
47 |
+
return datasets.DatasetInfo(
|
48 |
+
description=_DESCRIPTION,
|
49 |
+
features=datasets.Features(
|
50 |
+
{
|
51 |
+
"id": datasets.Value("string"),
|
52 |
+
"tokens": datasets.Sequence(datasets.Value("string")),
|
53 |
+
"ner_tags": datasets.Sequence(
|
54 |
+
datasets.features.ClassLabel(
|
55 |
+
names=[
|
56 |
+
"O",
|
57 |
+
"B-PER",
|
58 |
+
"I-PER",
|
59 |
+
"B-ORG",
|
60 |
+
"I-ORG",
|
61 |
+
"B-LOC",
|
62 |
+
"I-LOC",
|
63 |
+
"B-MISC",
|
64 |
+
"I-MISC",
|
65 |
+
]
|
66 |
+
)
|
67 |
+
),
|
68 |
+
}
|
69 |
+
),
|
70 |
+
supervised_keys=None,
|
71 |
+
homepage="https://arxiv.org/abs/1908.05828",
|
72 |
+
citation=_CITATION,
|
73 |
+
)
|
74 |
+
|
75 |
+
def _split_generators(self, dl_manager):
|
76 |
+
downloaded_file = dl_manager.download_and_extract(_URL)
|
77 |
+
return [
|
78 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_file})
|
79 |
+
]
|
80 |
+
|
81 |
+
def _generate_examples(self, filepath):
|
82 |
+
with open(filepath, encoding="utf-8") as f:
|
83 |
+
guid = 0
|
84 |
+
tokens = []
|
85 |
+
ner_tags = []
|
86 |
+
for line in f:
|
87 |
+
if line == "" or line == "\n":
|
88 |
+
if tokens:
|
89 |
+
yield guid, {
|
90 |
+
"id": str(guid),
|
91 |
+
"tokens": tokens,
|
92 |
+
"ner_tags": ner_tags,
|
93 |
+
}
|
94 |
+
guid += 1
|
95 |
+
tokens = []
|
96 |
+
ner_tags = []
|
97 |
+
else:
|
98 |
+
splits = re.split('\t+', line)
|
99 |
+
tokens.append(splits[0])
|
100 |
+
ner_tags.append(splits[1].rstrip())
|
101 |
+
yield guid, {
|
102 |
+
"id": str(guid),
|
103 |
+
"tokens": tokens,
|
104 |
+
"ner_tags": ner_tags,
|
105 |
+
}
|