Update conll2003.py
Browse files- conll2003.py +5 -7
conll2003.py
CHANGED
@@ -69,7 +69,6 @@ class Conll2003(datasets.GeneratorBasedBuilder):
|
|
69 |
{
|
70 |
"id": datasets.Value("string"),
|
71 |
"tokens": datasets.Sequence(datasets.Value("string")),
|
72 |
-
|
73 |
"ner_tags": datasets.Sequence(
|
74 |
datasets.features.ClassLabel(
|
75 |
names=[
|
@@ -80,12 +79,12 @@ class Conll2003(datasets.GeneratorBasedBuilder):
|
|
80 |
"I-CONT",
|
81 |
"B-EDU",
|
82 |
"I-EDU",
|
83 |
-
"B-SAL",
|
84 |
-
"I-SAL",
|
85 |
"B-CER",
|
86 |
"I-CER",
|
87 |
"B-EXP",
|
88 |
"I-EXP",
|
|
|
|
|
89 |
"B-LOC",
|
90 |
"I-LOC",
|
91 |
"B-ORG",
|
@@ -110,10 +109,9 @@ class Conll2003(datasets.GeneratorBasedBuilder):
|
|
110 |
}
|
111 |
|
112 |
return [
|
113 |
-
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": data_files["test"]}),
|
114 |
-
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": data_files["dev"]}),
|
115 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_files["train"]}),
|
116 |
-
|
|
|
117 |
]
|
118 |
|
119 |
def _generate_examples(self, filepath):
|
@@ -137,7 +135,7 @@ class Conll2003(datasets.GeneratorBasedBuilder):
|
|
137 |
# conll2003 tokens are space separated
|
138 |
splits = line.split(" ")
|
139 |
tokens.append(splits[0])
|
140 |
-
ner_tags.append(splits[
|
141 |
# last example
|
142 |
if tokens:
|
143 |
yield guid, {
|
|
|
69 |
{
|
70 |
"id": datasets.Value("string"),
|
71 |
"tokens": datasets.Sequence(datasets.Value("string")),
|
|
|
72 |
"ner_tags": datasets.Sequence(
|
73 |
datasets.features.ClassLabel(
|
74 |
names=[
|
|
|
79 |
"I-CONT",
|
80 |
"B-EDU",
|
81 |
"I-EDU",
|
|
|
|
|
82 |
"B-CER",
|
83 |
"I-CER",
|
84 |
"B-EXP",
|
85 |
"I-EXP",
|
86 |
+
"B-SAL",
|
87 |
+
"I-SAL",
|
88 |
"B-LOC",
|
89 |
"I-LOC",
|
90 |
"B-ORG",
|
|
|
109 |
}
|
110 |
|
111 |
return [
|
|
|
|
|
112 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_files["train"]}),
|
113 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": data_files["dev"]}),
|
114 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": data_files["test"]}),
|
115 |
]
|
116 |
|
117 |
def _generate_examples(self, filepath):
|
|
|
135 |
# conll2003 tokens are space separated
|
136 |
splits = line.split(" ")
|
137 |
tokens.append(splits[0])
|
138 |
+
ner_tags.append(splits[1].rstrip())
|
139 |
# last example
|
140 |
if tokens:
|
141 |
yield guid, {
|