firas-meddeb98 commited on
Commit
c6b1b9f
1 Parent(s): aeb5e13

Update dataset_nlp.py

Browse files
Files changed (1) hide show
  1. dataset_nlp.py +0 -10
dataset_nlp.py CHANGED
@@ -131,8 +131,6 @@ class Conll2003(datasets.GeneratorBasedBuilder):
131
  with open(filepath, encoding="utf-8") as f:
132
  guid = 0
133
  tokens = []
134
- pos_tags = []
135
- chunk_tags = []
136
  ner_tags = []
137
  for line in f:
138
  if line.startswith("-DOCSTART-") or line == "" or line == "\n":
@@ -140,28 +138,20 @@ class Conll2003(datasets.GeneratorBasedBuilder):
140
  yield guid, {
141
  "id": str(guid),
142
  "tokens": tokens,
143
- "pos_tags": pos_tags,
144
- "chunk_tags": chunk_tags,
145
  "ner_tags": ner_tags,
146
  }
147
  guid += 1
148
  tokens = []
149
- pos_tags = []
150
- chunk_tags = []
151
  ner_tags = []
152
  else:
153
  # conll2003 tokens are space separated
154
  splits = line.split(" ")
155
  tokens.append(splits[0])
156
- pos_tags.append(splits[1])
157
- chunk_tags.append(splits[2])
158
  ner_tags.append(splits[3].rstrip())
159
  # last example
160
  if tokens:
161
  yield guid, {
162
  "id": str(guid),
163
  "tokens": tokens,
164
- "pos_tags": pos_tags,
165
- "chunk_tags": chunk_tags,
166
  "ner_tags": ner_tags,
167
  }
 
131
  with open(filepath, encoding="utf-8") as f:
132
  guid = 0
133
  tokens = []
 
 
134
  ner_tags = []
135
  for line in f:
136
  if line.startswith("-DOCSTART-") or line == "" or line == "\n":
 
138
  yield guid, {
139
  "id": str(guid),
140
  "tokens": tokens,
 
 
141
  "ner_tags": ner_tags,
142
  }
143
  guid += 1
144
  tokens = []
 
 
145
  ner_tags = []
146
  else:
147
  # conll2003 tokens are space separated
148
  splits = line.split(" ")
149
  tokens.append(splits[0])
 
 
150
  ner_tags.append(splits[3].rstrip())
151
  # last example
152
  if tokens:
153
  yield guid, {
154
  "id": str(guid),
155
  "tokens": tokens,
 
 
156
  "ner_tags": ner_tags,
157
  }