stefan-it commited on
Commit
ff8c7b1
1 Parent(s): 2ae205c

utils: newlines in dataset instance were not handled correctly

Browse files
Files changed (1) hide show
  1. CreateDatasetSplits.ipynb +5 -2
CreateDatasetSplits.ipynb CHANGED
@@ -169,7 +169,7 @@
169
  },
170
  {
171
  "cell_type": "code",
172
- "execution_count": 14,
173
  "id": "29e1f3c9-3c3b-4541-840d-3db304966762",
174
  "metadata": {},
175
  "outputs": [],
@@ -181,6 +181,9 @@
181
  " for example in examples:\n",
182
  " label, sentence = example\n",
183
  "\n",
 
 
 
184
  " # We stick to Flair format for classification tasks, which is basically FastText inspired ;)\n",
185
  " new_label = \"__label__\" + label\n",
186
  " f_out.write(f\"{new_label} {sentence}\\n\")"
@@ -188,7 +191,7 @@
188
  },
189
  {
190
  "cell_type": "code",
191
- "execution_count": 15,
192
  "id": "502b3865-3efe-4730-9be8-ea675fd3feec",
193
  "metadata": {},
194
  "outputs": [],
 
169
  },
170
  {
171
  "cell_type": "code",
172
+ "execution_count": 10,
173
  "id": "29e1f3c9-3c3b-4541-840d-3db304966762",
174
  "metadata": {},
175
  "outputs": [],
 
181
  " for example in examples:\n",
182
  " label, sentence = example\n",
183
  "\n",
184
+ " # Fix!\n",
185
+ " sentence = sentence.replace(\"\\n\", \" \")\n",
186
+ " \n",
187
  " # We stick to Flair format for classification tasks, which is basically FastText inspired ;)\n",
188
  " new_label = \"__label__\" + label\n",
189
  " f_out.write(f\"{new_label} {sentence}\\n\")"
 
191
  },
192
  {
193
  "cell_type": "code",
194
+ "execution_count": 11,
195
  "id": "502b3865-3efe-4730-9be8-ea675fd3feec",
196
  "metadata": {},
197
  "outputs": [],