|
238 | 238 | "source": [
|
239 | 239 | "## Bonus Question\n",
|
240 | 240 | "\n",
|
241 |
| - "Optimize your solution for the above question by removing stop words from the BoW. For your convenience, a list of stop words is defined for you in the next cell. With the stop words removed, your output should look like:\n", |
| 241 | + "Now you want to improve your previous solution by removing the stop words from the corpus. The idea is you only want to add terms that are not in the `stop_words` list to the `bag_of_words` array.\n", |
242 | 242 | "\n",
|
243 |
| - "```\n", |
244 |
| - "bag_of_words = [am', 'at', 'cool', ironhack', 'is', 'love', 'student']\n", |
| 243 | + "Requirements:\n", |
245 | 244 | "\n",
|
246 |
| - "term_freq = [\n", |
247 |
| - "\t[0, 0, 1, 1, 1, 0, 0],\n", |
248 |
| - " \t[0, 0, 0, 1, 0, 1, 0],\n", |
249 |
| - " \t[1, 1, 0, 1, 0, 0, 1]\n", |
250 |
| - "]\n", |
251 |
| - "```\n", |
252 |
| - "\n", |
253 |
| - "**Requirements:**\n", |
254 |
| - "\n", |
255 |
| - "1. Combine all your previous codes to the cell below.\n", |
| 245 | + "1. Move all your previous codes from `main.ipynb` to the cell below.\n", |
256 | 246 | "1. Improve your solution by ignoring stop words in `bag_of_words`.\n",
|
257 | 247 | "\n",
|
258 | 248 | "After you're done, your `bag_of_words` should be:\n",
|
259 | 249 | "\n",
|
260 |
| - "```['ironhack', 'is', 'cool', 'love', 'am', 'student', 'at']```\n", |
| 250 | + "```['ironhack', 'cool', 'love', 'student']```\n", |
261 | 251 | "\n",
|
262 | 252 | "And your `term_freq` should be:\n",
|
263 | 253 | "\n",
|
264 |
| - "```[[1, 1, 1, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 1, 1, 1]]```" |
| 254 | + "```[[1, 1, 0, 0], [1, 0, 1, 0], [1, 0, 0, 1]]```" |
265 | 255 | ]
|
266 | 256 | },
|
267 | 257 | {
|
|
303 | 293 | " [1 1 0 1 0 0 1]]\n",
|
304 | 294 | " ```"
|
305 | 295 | ]
|
| 296 | + }, |
| 297 | + { |
| 298 | + "cell_type": "code", |
| 299 | + "execution_count": null, |
| 300 | + "metadata": {}, |
| 301 | + "outputs": [], |
| 302 | + "source": [] |
306 | 303 | }
|
307 | 304 | ],
|
308 | 305 | "metadata": {
|
|
0 commit comments