Thichow commited on
Commit
6c9f030
·
verified ·
1 Parent(s): 1c0f0e9

Update orchid_corpus.py

Browse files
Files changed (1) hide show
  1. orchid_corpus.py +8 -4
orchid_corpus.py CHANGED
@@ -163,12 +163,13 @@ class ThaiOrchidCorpus(datasets.GeneratorBasedBuilder):
163
  }
164
  replaced_tokens = [replacement_map.get(token, token) for token in token_buffer]
165
  # Join tokens to form the full sentence string
166
- full_sentence = "".join(token_buffer)
 
167
 
168
  # Yield the complete example
169
  yield sent_index, {
170
  "id": str(sent_index),
171
- "label_tokens": token_buffer,
172
  "pos_tags": label_buffer,
173
  "sentence": full_sentence,
174
  }
@@ -180,10 +181,13 @@ class ThaiOrchidCorpus(datasets.GeneratorBasedBuilder):
180
 
181
  # Handle final sentence if file doesn't end with a blank line
182
  if token_buffer:
183
- full_sentence = " ".join(token_buffer)
 
 
 
184
  yield sent_index, {
185
  "id": str(sent_index),
186
- "label_tokens": token_buffer,
187
  "pos_tags": label_buffer,
188
  "sentence": full_sentence,
189
  }
 
163
  }
164
  replaced_tokens = [replacement_map.get(token, token) for token in token_buffer]
165
  # Join tokens to form the full sentence string
166
+ # full_sentence = "".join(token_buffer)
167
+ full_sentence = "".join(replaced_tokens)
168
 
169
  # Yield the complete example
170
  yield sent_index, {
171
  "id": str(sent_index),
172
+ "label_tokens": replaced_tokens, #token_buffer,
173
  "pos_tags": label_buffer,
174
  "sentence": full_sentence,
175
  }
 
181
 
182
  # Handle final sentence if file doesn't end with a blank line
183
  if token_buffer:
184
+ replaced_tokens = [replacement_map.get(token, token) for token in token_buffer]
185
+ # Join tokens to form the full sentence string
186
+ # full_sentence = "".join(token_buffer)
187
+ full_sentence = "".join(replaced_tokens)
188
  yield sent_index, {
189
  "id": str(sent_index),
190
+ "label_tokens": replaced_tokens, #token_buffer,
191
  "pos_tags": label_buffer,
192
  "sentence": full_sentence,
193
  }