SuzanaB commited on
Commit
524481d
1 Parent(s): 9f1906a

Fix norm/lemma

Browse files
Files changed (2) hide show
  1. data.zip +0 -0
  2. reldi_sr.py +14 -8
data.zip CHANGED
Binary files a/data.zip and b/data.zip differ
 
reldi_sr.py CHANGED
@@ -30,9 +30,9 @@ _HOMEPAGE = ''
30
  _LICENSE = ''
31
 
32
  _URL = 'https://huggingface.co/datasets/classla/reldi_sr/raw/main/data.zip'
33
- _TRAINING_FILE = 'train_ner.conllu'
34
- _DEV_FILE = 'dev_ner.conllu'
35
- _TEST_FILE = 'test_ner.conllu'
36
 
37
 
38
  class ReldiSr(datasets.GeneratorBasedBuilder):
@@ -51,6 +51,7 @@ class ReldiSr(datasets.GeneratorBasedBuilder):
51
  {
52
  'sent_id': datasets.Value('string'),
53
  'tokens': datasets.Sequence(datasets.Value('string')),
 
54
  'lemmas': datasets.Sequence(datasets.Value('string')),
55
  'upos_tags': datasets.Sequence(datasets.Value('string')),
56
  'xpos_tags': datasets.Sequence(datasets.Value('string')),
@@ -111,6 +112,7 @@ class ReldiSr(datasets.GeneratorBasedBuilder):
111
  with open(filepath, encoding='utf-8') as f:
112
  sent_id = ''
113
  tokens = []
 
114
  lemmas = []
115
  upos_tags = []
116
  xpos_tags = []
@@ -124,6 +126,7 @@ class ReldiSr(datasets.GeneratorBasedBuilder):
124
  yield data_id, {
125
  'sent_id': sent_id,
126
  'tokens': tokens,
 
127
  'lemmas': lemmas,
128
  'upos_tags': upos_tags,
129
  'xpos_tags': xpos_tags,
@@ -131,6 +134,7 @@ class ReldiSr(datasets.GeneratorBasedBuilder):
131
  'iob_tags': iob_tags
132
  }
133
  tokens = []
 
134
  lemmas = []
135
  upos_tags = []
136
  xpos_tags = []
@@ -141,15 +145,17 @@ class ReldiSr(datasets.GeneratorBasedBuilder):
141
  else:
142
  splits = line.split('\t')
143
  tokens.append(splits[1].strip())
144
- lemmas.append(splits[2].strip())
145
- upos_tags.append(splits[3].strip())
146
- xpos_tags.append(splits[4].strip())
147
- feats.append(splits[5].strip())
148
- iob_tags.append(splits[9].strip())
 
149
 
150
  yield data_id, {
151
  'sent_id': sent_id,
152
  'tokens': tokens,
 
153
  'lemmas': lemmas,
154
  'upos_tags': upos_tags,
155
  'xpos_tags': xpos_tags,
 
30
  _LICENSE = ''
31
 
32
  _URL = 'https://huggingface.co/datasets/classla/reldi_sr/raw/main/data.zip'
33
+ _TRAINING_FILE = 'train_all.conllu'
34
+ _DEV_FILE = 'dev_all.conllu'
35
+ _TEST_FILE = 'test_all.conllu'
36
 
37
 
38
  class ReldiSr(datasets.GeneratorBasedBuilder):
 
51
  {
52
  'sent_id': datasets.Value('string'),
53
  'tokens': datasets.Sequence(datasets.Value('string')),
54
+ 'norms': datasets.Sequence(datasets.Value('string')),
55
  'lemmas': datasets.Sequence(datasets.Value('string')),
56
  'upos_tags': datasets.Sequence(datasets.Value('string')),
57
  'xpos_tags': datasets.Sequence(datasets.Value('string')),
 
112
  with open(filepath, encoding='utf-8') as f:
113
  sent_id = ''
114
  tokens = []
115
+ norms = []
116
  lemmas = []
117
  upos_tags = []
118
  xpos_tags = []
 
126
  yield data_id, {
127
  'sent_id': sent_id,
128
  'tokens': tokens,
129
+ 'norms': norms,
130
  'lemmas': lemmas,
131
  'upos_tags': upos_tags,
132
  'xpos_tags': xpos_tags,
 
134
  'iob_tags': iob_tags
135
  }
136
  tokens = []
137
+ norms = []
138
  lemmas = []
139
  upos_tags = []
140
  xpos_tags = []
 
145
  else:
146
  splits = line.split('\t')
147
  tokens.append(splits[1].strip())
148
+ norms.append(splits[2].strip())
149
+ lemmas.append(splits[3].strip())
150
+ upos_tags.append(splits[4].strip())
151
+ xpos_tags.append(splits[5].strip())
152
+ feats.append(splits[6].strip())
153
+ iob_tags.append(splits[7].strip())
154
 
155
  yield data_id, {
156
  'sent_id': sent_id,
157
  'tokens': tokens,
158
+ 'norms': norms,
159
  'lemmas': lemmas,
160
  'upos_tags': upos_tags,
161
  'xpos_tags': xpos_tags,